Skip to content
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

Feat: Persist code block tab selection to locaStorage #9367

Merged
merged 4 commits into from
Mar 15, 2024

Conversation

a-hariti
Copy link
Collaborator

@a-hariti a-hariti commented Mar 6, 2024

This comes at the expense of some inevitable hydration errors

Pre-merge checklist

If you work at Sentry, you're able to merge your own PR without review, but please don't unless there's a good reason.

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs
  • PR was reviewed and approved by a member of the Sentry docs team

Description of changes

This is useful for platforms like Java/Kotlin where it makes more sense to have the selection survive a page reload

Caveat: this introduces a jump after hydration if the stored selection is different from the default (first one)

Ideally this info should be stored in a cookie, but we can't do it since the pages are statically generated.

Closes #3051

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Extra resources

This comes at the expense of some inevitable hydration errors
Copy link

vercel bot commented Mar 6, 2024

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

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 7, 2024 11:01am

Copy link
Contributor

@lizokm lizokm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there was a small typo :)

src/components/codeContext.tsx Outdated Show resolved Hide resolved
src/components/codeContext.tsx Outdated Show resolved Hide resolved
src/components/codeContext.tsx Outdated Show resolved Hide resolved
@lizokm lizokm merged commit 8fb29e2 into master Mar 15, 2024
8 checks passed
@lizokm lizokm deleted the persist-codeblock-selection branch March 15, 2024 20:36
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Persist Language Selection
2 participants