Skip to content

Undetected location state changes while using browser back/forward buttons #275

Closed

Description

@oedotme

Describe the bug

Navigation to the same route path with different state is detected using navigate(path, { state: ...}) directly — however when using browser back/forward buttons, the state changes are not detected until the page is refreshed.

Your Example Website or App

https://stackblitz.com/edit/solid-router-back-forward-undetected-state-change

Steps to Reproduce the Bug or Issue

  1. Navigate to the StackBlitz repro link
  2. Wait for the installation to finish and the dev server to start
  3. Important Open the preview in a new tab Open in New Tab
  4. Initial state should be null
  5. Click on Go to about with active true button
  6. You'll see the page updating to /about and the state is {"active": true}
  7. Click on the browser back button
  8. You'll see the home page / and the state is null
  9. Click on Go to home with active false button
  10. You'll see the home page / and the state is {"active":false}
  11. Click on the browser back button
  12. You'll still see the home page / and the state is {"active":false} the unexpected behavior
  13. Refresh the page
  14. You'll see the home page / and the state is null expected at 12. without refresh

Expected behavior

Same steps as above in the reproduction, starting from 11:

  1. Click on the browser back button
  2. See the home page / and the state is null without refreshing the page

Same with the browser forward button

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Brave - Chromium based
  • Chromium Version: 114.0.5735.133
  • Brave Version: 1.52.126

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions