-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sveltekit flags enhancements #75
Draft
dummdidumm
wants to merge
16
commits into
main
Choose a base branch
from
sveltekit-flags-enhancements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+1,410
−351
Conversation
This file contains 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
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
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? |
New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎
|
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_SECRET
manually anymore. This means Vite will have to compile this in the context of the app, but that's not a problem and should happen automaticallyhandle
hook, with a request object being the key for deduplication etc. This allows it to be called from e.g. edge middlewareMap
onto 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 aligncreatePrecomputedFlags
which 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 reroute
feature in SvelteKit.