ladle icon indicating copy to clipboard operation
ladle copied to clipboard

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

Open viddo opened this issue 7 months ago • 0 comments

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

viddo avatar May 28 '25 13:05 viddo