-
Notifications
You must be signed in to change notification settings - Fork 28
experimental: embed bootstrap data #145
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
Draft
dferber90
wants to merge
13
commits into
main
Choose a base branch
from
experimental-embedding
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
Conversation
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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This is a fork of htmlrewriter (no dash) which fixes the node compatibility issues while we wait for remorses/htmlrewriter#6 to land and get fixed upstream
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
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.
Goal
The goal is to make it possible to experiment on marketing pages without causing layout shift, while still being able to serve the different variants from a CDN.
Constraints
We do not want to use client-side experimentation as it leads to layout shift. We can not have any information about the user on the cached page itself as it would lead to cache poisoning or very bad cache hit rates.
However, the flags client (eg Statsig) must still be aware of the experiment running on the server and must be able to bootstrap itself so it can track events.
Approach
This solves multiple problems
Added methods
We're adding several methods to the Flags SDK to make this nicer to work with.
embedBootstrapData(response, data): Response
call this from Edge Middleware to embed data into the response<FlagBootstrapData />
render this in a top-level layout, its contents will be replaced byembedBootstrapData
useBootstrapData()
a hook which returns the data embedded byembedBootstrapData
Snapshot release
You can try out this logic in the
flags@4.1.0-4ebe698e-20250613112000
snapshot release.