Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: hide dynamic ssg endpoint resolution under environment variable #7011

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

VitaliyR
Copy link
Contributor

@VitaliyR VitaliyR commented Jan 22, 2025

🎉 Thanks for submitting a pull request! 🎉

Summary

Hides this functionality under env var for better control/transition period while discussing it.

Discussion at https://netlify.slack.com/archives/C03ETTLQ9BP/p1737489833462809


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@VitaliyR VitaliyR requested a review from a team as a code owner January 22, 2025 13:40
Copy link

📊 Benchmark results

Comparing with da7f42e

  • Dependency count: 1,179 (no change)
  • Package size: 315 MB (no change)
  • Number of ts-expect-error directives: 804 (no change)

@@ -354,7 +354,10 @@ const serveRedirect = async function ({
const reqUrl = reqToURL(req, req.url)

const staticFile = await getStatic(decodeURIComponent(reqUrl.pathname), options.publicFolder)
const endpointExists = !staticFile && (await isEndpointExists(decodeURIComponent(reqUrl.pathname), options.target))
const endpointExists =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a feature flag instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we are using env vars for this in other places. Also, I want it to be global solution for dev servers via env var (so dev server when initializing sets this env var, while feature flag is set per user, isn't it?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while feature flag is set per user, isn't it?

You can target a feature flag for all users or for a subset of them using whatever targeting criteria you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but for now it's easier to do it like that (+ also we use the same approach for other dev-server related things)
Anyway, I still want to bring it to discussion and move it out from the "behind curtain" block

@VitaliyR VitaliyR merged commit 9669cdf into main Jan 22, 2025
49 checks passed
@VitaliyR VitaliyR deleted the ssg-endpoint-redirect branch January 22, 2025 14:20
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants