ladle
ladle copied to clipboard
Using browser back button causes Ladle to wipe browser history and go back to 1st/default story
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
- OS: MacOS 15.5 (24F74)
- Browser Latest Version 1.78.102 Chromium: 136.0.7103.113 (Official Build) (arm64), Safari Version 18.5 (20621.2.5.11.8)
- Version 5.0.3 (latest stable)