feat: auto-select US or EU based on cloud region#16132
Open
vmaineng wants to merge 1 commit intoPostHog:masterfrom
Open
feat: auto-select US or EU based on cloud region#16132vmaineng wants to merge 1 commit intoPostHog:masterfrom
vmaineng wants to merge 1 commit intoPostHog:masterfrom
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
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.
Closes #15894
Changes
Auto-selects the US/EU code snippet tabs based on the user's cloud region, so users no longer have to manually switch tabs when following docs.
After digging into the codebase, PostHog already has feature flags (
direct-to-eu-cloud/direct-to-us-cloud) that determine a user's cloud region. This PR wires those existing flags into the tab selection logic in two places:src/components/CodeBlock/index.tsx— whendirect-to-eu-cloudis enabled, the EU tab is now auto-selected in addition to the existingregionstring replacement that was already happeningsrc/components/Tab/index.tsx— addeduseCloud()hook so generic US/EU tabs also auto-select based on cloud region, with the correct priority chain:?tab=param (highest priority, preserves shareable links)Testing
Tested locally by temporarily setting the
direct-to-eu-cloudcondition totrueinCodeBlockand confirming the EU tab auto-selects on pages withfile=US/file=EUcode blocks (e.g./docs/advanced/proxy/nextjs).vercel.json