chromaui / addon-visual-tests

Visual Tests addon for Storybook
MIT License
28 stars 1 forks source link

State is lost when switching to docs page #273

Closed yannbf closed 3 months ago

yannbf commented 3 months ago

Describe the bug

When testing on a new project (a project I created from scratch, not from git), I ran my first successful build which showed the snapshots, but then as I switched stories, it showed as if I didn’t run any tests and had no snapshots:

image

Here's a video explaining it in more detail: https://github.com/chromaui/addon-visual-tests/assets/1671563/8e1d13e7-3e01-405c-9b11-f89892770913

To reproduce

1 - Pick any Storybook sandbox at https://storybook.new, or just pick any project you like. 2 - Set up Chromatic for the first time (clear cookies, etc) 3 - Run your first build 4 - Look at the panel, it should show the snapshots correctly 5 - Refresh the browser, or switch between a docs story and normal story 6 - The panel should show the incorrect state now

Environment

MacOS - Latest Chrome - Storybook 8.0.4 - Addon version ^1.2.25

ghengeveld commented 3 months ago

Looks like we lose all state when switching to a docs page, which makes sense given that the addon panel is completely unmounted in that case. We'll have to do some persistence to get around it.