Skip to content

Conversation

@rogeriochaves
Copy link

@rogeriochaves rogeriochaves commented Nov 8, 2025

Hey there, this is also another feature we are currently using on Scenario that I think should benefit other vocs user:

https://scenario.langwatch.ai/

===

Adds state management to CodeGroup component to synchronize tab selection across all code groups on the same page and persist user preference to localStorage.

When a user selects a language tab (e.g., TypeScript, JavaScript), all other code groups on the page automatically switch to the same language, and the preference is saved. When the user returns to the documentation, their preferred language is automatically selected.

Key features:

  • Synchronizes tab selection across all CodeGroup instances on the page
  • Persists selection to localStorage for future visits
  • Cross-tab synchronization using storage events
  • Same-page synchronization using custom events
  • Graceful error handling for SSR and private browsing mode
  • Only switches to tabs that exist in each code group

This significantly improves UX for users who consistently prefer one language, eliminating the need to manually switch tabs on every code example.

It also allows listening to external components changing the global language, e.g. this select we have on top:

image

…ference

Adds state management to CodeGroup component to synchronize tab selection
across all code groups on the same page and persist user preference to
localStorage.

When a user selects a language tab (e.g., TypeScript, JavaScript), all
other code groups on the page automatically switch to the same language,
and the preference is saved. When the user returns to the documentation,
their preferred language is automatically selected.

Key features:
- Synchronizes tab selection across all CodeGroup instances on the page
- Persists selection to localStorage for future visits
- Cross-tab synchronization using storage events
- Same-page synchronization using custom events
- Graceful error handling for SSR and private browsing mode
- Only switches to tabs that exist in each code group

This significantly improves UX for users who consistently prefer one
language, eliminating the need to manually switch tabs on every code
example.
@vercel
Copy link

vercel bot commented Nov 8, 2025

@rogeriochaves is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant