Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…'t have to pass FLAGS_SECRET manually anymore then
…with a request object being the key for deduplication etc
fe9a804 to
f084706
Compare
Contributor
Author
|
Ready for review - let me know if the examples need tweaking / should be aligned in specific ways with the Next examples. Also, is there anything with regards to the docs we should be updating / adjusting at the same time? |
dferber90
approved these changes
Mar 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This enhances the SvelteKit adapter in several ways:
$env/dynamic/private, which means people don't have to passFLAGS_SECRETmanually anymore. This means Vite will have to compile this in the context of the app, but that's not a problem and should happen automaticallyhandlehook, with a request object being the key for deduplication etc. This allows it to be called from e.g. edge middlewareMaponto the context in which flags run, with the identify function being the key. That means calls are deduplicated automatically as soon as you share a stable reference to the function across flagsaddmodel precompute API closely after Next.js to aligncreatePrecomputedFlagswhich is a function for generating permutations, then precomputing one and retrieving it. It's different to the Next.js API because it does not need you to pass the array of flags everywhere, instead you define which flags belong to which route param once and then access methods on the returned object. Using it feels a bit nicer than the Next.js approach IMO, but open to suggestionsThis needs sveltejs/kit#13477 to land first, so that you can actually precompute something in middleware, and it would be good to also enhance the example SvelteKit app as well then.Makes use of the newasync reroutefeature in SvelteKit.