-
Notifications
You must be signed in to change notification settings - Fork 4
Add read-only mode for US users #1574
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
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
6 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though this is more than the hook, I opted to put it in /hooks since that's the only way it's meant to be used outside of the single provider in App. I consider the context an implementation detail.
DannyDelott
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excited to have a read-only mode 🎉
| const region = new URL(window.location.href).searchParams | ||
| .get("region") | ||
| ?.toLocaleLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use add a validateSearch to the home route and use useSearch({ from: "/" }) instead? It'd be nice to have the source of truth for all search params live next to the routes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The router provider lives in App, so the hooks can't be used here. But I think that's ok since we really shouldn't be referencing this search param outside of this function. The hook is the only source of truth since it will ensure the context persists through route changes.
The PR adds a new
RegionInfocontext, provider, and hook which checks the URL query string for aregionvalue against a list of read-only regions. This query parameter will automatically be added to requests at the edge via Cloudflare.Screen.Recording.2024-10-14.at.4.25.34.PM.mov