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: Reload on mount #2200

Merged
merged 2 commits into from
Jan 21, 2025
Merged

Fix: Reload on mount #2200

merged 2 commits into from
Jan 21, 2025

Conversation

joetannenbaum
Copy link
Contributor

This PR should fix an issue where we try to save the initial scroll state before we even have any history state.

Should fix #2195

@joetannenbaum joetannenbaum merged commit b70f216 into master Jan 21, 2025
8 checks passed
@joetannenbaum joetannenbaum deleted the reload-after-location-fix branch January 21, 2025 16:35
@danmatthews
Copy link

Thanks @joetannenbaum

@blackjak231
Copy link

blackjak231 commented Jan 22, 2025

@joetannenbaum the issue seems to still be relevant on Safari iOS. Here is the line indicated by Sentry :

Type Error: null is not an object (evaluating 'window.history.state.page')

{snip} 
solve().then(()=>{this.doReplaceState({page:window.history.state.page,documentScrollPosition:e},this.current.url)}))}getScrollRegions(){retu 
{snip}

However, I have no idea why it's triggering an error and I'm still investigating.

@cgaube
Copy link

cgaube commented Jan 24, 2025

We are also seeing on firefox
Screenshot 2025-01-24 at 10 06 35

return window.history.state.scrollRegions || []

  public getScrollRegions(): ScrollRegion[] {
    return window.history.state.scrollRegions || []
  }

should be

  public getScrollRegions(): ScrollRegion[] {
    return window.history.state?.scrollRegions || []
  }

I guess the entire file needs to be looked at a bit knowing that state can be null

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.

Bad developer practice causes JS exception
4 participants