-
-
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
UI: Fix enableShortcuts, exclude it from being persisted #21291
Conversation
fix issue where setConfig would not call with full value fix issue where state.ui is persisted where it should not
@@ -253,7 +253,7 @@ export const init: ModuleFn = ({ store, provider, singleStory, fullAPI }) => { | |||
}, | |||
}; | |||
|
|||
const persisted = pick(store.getState(), 'layout', 'ui', 'selectedPanel'); | |||
const persisted = pick(store.getState(), 'layout', 'selectedPanel'); |
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.
Can you explain this change? Seems sort of wide ranging?
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.
storybook/code/lib/types/src/modules/api.ts
Lines 105 to 109 in 42fae30
export interface API_UI { | |
name?: string; | |
url?: string; | |
enableShortcuts: boolean; | |
} |
According to the types, these are the only options allowed in this object... And I think none of these should really be persisted!
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.
The main part of this seems good. Very unsure about the persistence change though.
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.
@ndelangen Thanks for fixing this! The code looks OK for me.
However, as I was testing it, I found that I needed to do a hard reload in the browser after restarting Storybook, which still feels like a bug. Is there any way we can fix this?
I also tested a few of the other UI options and they don't work. Can open a separate issue if you think it's unrelated to this PR:
isFullscreen: true,
panelPosition: 'bottom',
showRoots: false,
@tmeasday I found that anything you put into
I assume when you say "restarting storybook" that includes a browser refresh? So you're saying you had to refresh twice to see the effect? That would be a bug, though I'm not sure what the problem is... |
@shilman what you found, is related to persistence, and it's an existing issue. What happens is:
TLDR: This PR, fixes that for |
@shilman I've verified, that setting: addons.setConfig({
panelPosition: 'right',
}); ...will work, only if you clear site data first. I'm not sure what else to expect.. |
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.
Let's merge this and figure out a proper solution to this later
Closes #6569
What I did
fix issue where if setConfig is called before channel is setup it no-ops
fix issue where setConfig would not call with full value
fix issue where state.ui is persisted where it should not
How to test
enableShortcuts: true
inmanager.js
, check if keyboardshortcuts workenableShortcuts: false
inmanager.js
, check if keyboardshortcuts are indeed no longer workingenableShortcuts: true
inmanager.js
, check if keyboardshortcuts wokring again.Between each step you will have to restart storybook.