Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve selected mode and/or browser, if possible, while navigating between stories #203

Conversation

andrewortwein
Copy link
Contributor

@andrewortwein andrewortwein commented Mar 8, 2024

This allows you to select a particular mode/browser and, when you navigate to another story, show that same mode/browser (if it's available). Theoretically this is a nice way to quickly jump between stories.

Specifically, when navigating from one story to another, we will:

  1. Try to load a test with changes that matches the same mode/browser
  2. If that doesn't exist, try to load the first test with changes
  3. If that doesn't exist, try to load an unchanged test that matches the same mode/browser
  4. If that doesn't exist, load the first unchanged test

This puts an emphasis on tests with changes while still trying to preserve the mode/browser that the user selects.

Prior to this change, we were trying to load the mode that matches the theme selected in the SB toolbar. I removed this for now because, while nice, it felt incomplete to me. Modes can be more than just themes. If we selected a mode that matched every SB global selected, that would feel consistent and expected. Until then, I prefer to not try to do it at all.

📦 Published PR as canary version: 1.2.11--canary.203.d36a470.0

✨ Test out this PR locally via:

npm install @chromatic-com/storybook@1.2.11--canary.203.d36a470.0
# or 
yarn add @chromatic-com/storybook@1.2.11--canary.203.d36a470.0

@andrewortwein andrewortwein changed the title Andrew/ap-4219-preserve-state-of-modesbrowsers-as-a-navigate-between Preserve selected mode and/or browser, if possible, while navigating between stories Mar 8, 2024
@andrewortwein andrewortwein marked this pull request as draft March 8, 2024 15:52
@andrewortwein andrewortwein marked this pull request as ready for review March 8, 2024 22:48
Copy link
Member

@thafryer thafryer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good! QA passed too!

@andrewortwein andrewortwein merged commit 564ee3b into main Mar 8, 2024
6 checks passed
@andrewortwein andrewortwein deleted the andrew/ap-4219-preserve-state-of-modesbrowsers-as-a-navigate-between branch March 8, 2024 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants