Skip to content

Using browser back button causes Ladle to wipe browser history and go back to 1st/default story #617

@viddo

Description

@viddo

Describe the bug

It seems like the browser history handling is not working properly, after navigating through that are at least one level deep. I've seen this for several versions but didn't have a clear reproduce case.

Figure there's something about the history dep/usage that is not worker proper.

Reproduction

https://stackblitz.com/edit/ladle-f5d3gvuf but in case that doesn't work:

Setup using Stackblitz:

  • Add at least one more story under controls.stories.ts - e.g. export const OtherNestedStory = () => null; - contents doesn't matter but need at least two stories for reproduce

Once you have that setup:

  • Do some navigation, e.g. from 1st/default story (Basic > Hello, should already been selected and rendered) to "Controls > Controls", followed by "Controls > "Other nested story"
  • Click back button in browser

Expected result

Browser history navigation to work proper, i.e. go back/forward to show prev/next story per URL history

Actual result

1st/default story is rendered and browser history is wiped.

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions