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

Addon-docs: Fix renaming stories on module / MDX format #7319

Merged
merged 2 commits into from
Jul 5, 2019

Conversation

shilman
Copy link
Member

@shilman shilman commented Jul 5, 2019

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

yarn jest --testPathPattern story_store.test.js

Also

cd examples/official-storybook
yarn storybook

Then edit a story name in addon-docs.stories.mdx and observe that it updates as expected in the UI.

@shilman shilman added bug patch:yes Bugfix & documentation PR that need to be picked to main branch addon: docs labels Jul 5, 2019
@shilman shilman added this to the 5.1.x milestone Jul 5, 2019
@vercel
Copy link

vercel bot commented Jul 5, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://monorepo-git-7169-fix-renaming-stories.storybook.now.sh

@shilman shilman changed the title Addon-docs: Addon-docs: Fix renaming stories on module / MDX format Jul 5, 2019
@@ -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]) => {
Copy link
Member

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..

Copy link
Member Author

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?

@shilman shilman merged commit cd87934 into next Jul 5, 2019
@shilman shilman deleted the 7169-fix-renaming-stories branch July 5, 2019 23:31
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Jul 31, 2019
shilman added a commit that referenced this pull request Jul 31, 2019
Addon-docs: Fix renaming stories on module / MDX format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: docs bug patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants