-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Persist background for @addon/background #3331
Conversation
|
||
this.channel.on('background-set', backgrounds => { | ||
this.setState({ backgrounds }); | ||
const currentBackground = api.getQueryParam('background'); | ||
const currentBackground = api.getQueryParam('background') || this.state.currentBackground; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer URL to be the single source of truth here. We already persist background changes in URL, let's just stop resetting that on story change:
https://github.com/wuweiweiwu/storybook/blob/12c5af9e513f989e03db87475811b86a4cdd718a/addons/background/src/BackgroundPanel.js#L91
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! Will update :)
Codecov Report
@@ Coverage Diff @@
## master #3331 +/- ##
==========================================
- Coverage 35.63% 35.62% -0.01%
==========================================
Files 472 472
Lines 10122 10121 -1
Branches 970 937 -33
==========================================
- Hits 3607 3606 -1
- Misses 5900 5918 +18
+ Partials 615 597 -18
Continue to review full report at Codecov.
|
@Hypnosphi Done! :) |
Issue: #2383
What I did
don't unset background url when changing stories.
How to test
Is this testable with Jest or Chromatic screenshots?
yes
Does this need a new example in the kitchen sink apps?
no
Does this need an update to the documentation?
no
If your answer is yes to any of these, please make sure to include it in your PR.