-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
fix: addons-background not updating default value #18456
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 8bbedba. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
@bytrangle So here's what I think should happen: global background should have no value ( If globals does have a background, a user has manually set this background, and storybook should respect this background. In other words: globals trump parameters. What I can see what's incorrect today is when the user sets a background via the ui (sets globals) then clears the background, the value in globals should become |
globals[BACKGROUNDS_PARAM_KEY] = { | ||
value: defaultSetting.value, | ||
}; |
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.
This isn't right, we should not be mutating globals
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.
Is calling updateGlobals
a good solution?
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.
No we should not put the background value coming from parameters into the global.
What we want to do instead is read both in the place where we apply the background:
If the global.background is set, apply the CSS value to that.
if the global.background is null, but the parameter is set, apply the CSS value to that.
if neither have a valid value, clear the CSS styles applied, so there is no background color applied at all.
@ndelangen Upon further investigation, there are two important values that
So the fact that global background color becomes But the original issue that my PR spawns from is about a decorator getting empty object when calling |
@ndelangen On further consideration, I think there are two potential complications with setting global background as
WDYT? |
It's acceptable
you set background-color property to transparent. I know this is not CSS, but I feel like designating background-color as null will throw many users off. |
Issue: fixes #15632
What I did
globals
object has thebackgrounds
propertybackgroundsConfig
globals
object with default background colorHow to test
If your answer is yes to any of these, please make sure to include it in your PR.