Skip to content

Conversation

@ryangoree
Copy link
Member

The PR adds a new RegionInfo context, provider, and hook which checks the URL query string for a region value 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

@changeset-bot
Copy link

changeset-bot bot commented Oct 14, 2024

⚠️ No Changeset found

Latest commit: 87c11a4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Oct 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hyperdrive-mainnet-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 10:17pm
hyperdrive-sepolia-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 10:17pm
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
hyperdrive-js ⬜️ Ignored (Inspect) Visit Preview Oct 14, 2024 10:17pm
hyperdrive-mainnet-production ⬜️ Ignored (Inspect) Visit Preview Oct 14, 2024 10:17pm
hyperdrive-sepolia-production ⬜️ Ignored (Inspect) Visit Preview Oct 14, 2024 10:17pm
testnet-v1 ⬜️ Ignored (Inspect) Oct 14, 2024 10:17pm
testnet-v1.0.6 ⬜️ Ignored (Inspect) Visit Preview Oct 14, 2024 10:17pm
trading-competition ⬜️ Ignored (Inspect) Visit Preview Oct 14, 2024 10:17pm

Copy link
Member Author

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.

Copy link
Contributor

@DannyDelott DannyDelott left a 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 🎉

Comment on lines +32 to +34
const region = new URL(window.location.href).searchParams
.get("region")
?.toLocaleLowerCase();
Copy link
Contributor

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.

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants