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

fix: don't modify history state when loading toolbar #1162

Merged
merged 2 commits into from
May 7, 2024

Conversation

panrafal
Copy link
Contributor

@panrafal panrafal commented May 5, 2024

Modifying state may break on applications that use it, like Next.js.

Changes

Reuses the current history state when calling replaceState that removes hash from the URL.

Next.js apps rely on the state object. Calling replaceState("", ...) throws making the toolbar unusable.

...

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)

Modifying state may break on applications that use it, like Next.js.
Copy link

vercel bot commented May 5, 2024

@panrafal is attempting to deploy a commit to the PostHog Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

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

this seems totally reasonable based on the docs

@pauldambra pauldambra changed the title Don't modify history state when loading toolbar fix: don't modify history state when loading toolbar May 7, 2024
@pauldambra
Copy link
Member

I'm going to merge this without publishing a new version so I can check the tests without messing around :)

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.

2 participants