-
-
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
Addon-docs: Fix renaming stories on module / MDX format #7319
Conversation
This pull request is automatically deployed with Now. Latest deployment for this branch: https://monorepo-git-7169-fix-renaming-stories.storybook.now.sh |
@@ -271,6 +280,13 @@ export default class StoryStore extends EventEmitter { | |||
removeStoryKind(kind) { | |||
if (this.hasStoryKind(kind)) { | |||
this._legacydata[toKey(kind)].stories = {}; | |||
|
|||
this._data = Object.entries(this._data).reduce((acc, [id, story]) => { |
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 feel a fear of recursion if both api's call each other..
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.
Fortunately they don't -- they just modify the data structures directly?
Addon-docs: Fix renaming stories on module / MDX format
Issue: #7169
What I did
Update story_store to keep _data and _legacydata in sync.
NOTE: we should deprecate _legacydata functions and remove them
How to test
Also
Then edit a story name in
addon-docs.stories.mdx
and observe that it updates as expected in the UI.