-
-
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
Allow replacing of stories with a warning (rather than an error) #4061
Conversation
fixes storybookjs#4056 remove try catch in test
I originally made the changes on a release branch so I'm just running through the tests on master to make sure nothing has broken. |
I can fix the tests for master, but that will break the tests for 3.4 when and if the commit is cherry picked. EDIT: I'll try fix them for both. |
@@ -95,7 +95,7 @@ export default class ClientApi { | |||
} | |||
|
|||
if (this._storyStore.hasStory(kind, storyName)) { | |||
throw new Error(`Story of "${kind}" named "${storyName}" already exists`); | |||
logger.warn(`Story of "${kind}" named "${storyName}" already exists`); |
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.
Basically, I agree with this change, though I wonder whether we want to replace an existing story in the store with this kind
@tmeasday you've worked a lot in this area. WDYT ?
@storybooks/team, does anyone want to give a feedback? |
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.
LGTM. Nice tests!
Thanks for the approval. If there's anything I can do to get this into the v3 stream please let me know. |
I think we need to merge in master, I can do it today. |
@michaelduminy I will cherry-pick it to |
Allow replacing of stories (again)
Issue: #4056
What I did
Replaced the error thrown when adding an already existing story with a console.warn. Created a test that covers this case. Note: console.warn is mocked as the jest config throws an error when this is called.