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

Values Bleeding Between Stories #794

Closed
shilman opened this issue Apr 15, 2017 · 11 comments
Closed

Values Bleeding Between Stories #794

shilman opened this issue Apr 15, 2017 · 11 comments

Comments

@shilman
Copy link
Member

shilman commented Apr 15, 2017

Issue by philcockfield
Tuesday Oct 04, 2016 at 19:25 GMT
Originally opened as storybook-eol/storybook-addon-knobs#55


I have two stories that load two different components that both have a size property.
If I have a knob for setting that size like so:

// For component-1
size={knobs.number('size', 60)}

// For component-2
size={knobs.number('size', 12)}

When I load component-2, I'm seeing the component-1 value of 60.

This is on ReactNative, not sure if that makes a difference. Also, possibly related to this, there is a little bit of weirdness when jumping between stories with the knobs panel not re-rendering to represent the currently loaded stories knobs settings.

Thanks guys!

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by arunoda
Tuesday Oct 04, 2016 at 23:12 GMT


@philcockfield may be that's something with RN.
@roonyh could you check that and bring onStory knobs clear feature soon.

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by arunoda
Thursday Oct 06, 2016 at 03:04 GMT


@philcockfield we have looked into this it's RN only.
We do knobs config stuff only when the component rendered for the first time.
In React Storybook, this is not a problem since it's always render by clearing the old story.

That's not the case in RN. We don't do that.
So, now we are trying to clear the old story when switching stories.
If not we'll do something.

I hope @roonyh could something about this today or tomorrow.

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by roonyh
Thursday Oct 06, 2016 at 10:01 GMT


@philcockfield I just published rn-storybook v2.1.4 with the fix in storybook-eol/react-native-storybook#104. It makes sure that a story is mounted completely.

This should probably fix the issues you describe. Could you try updating rn-storybook to 2.1.4 and try it out?

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by wordofchristian
Friday Jan 13, 2017 at 18:48 GMT


I can confirm this occurs with react web as well, not just react native. The query strings seem to persist when switching between stories. It also continues to show the knobs from the previous story on the new one (even if the new story doesn't have any knobs). This creates a confusing UI experience.

Perhaps I'm experiencing a different issue than the one you're describing

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by ChristopherBiscardi
Monday Feb 06, 2017 at 22:03 GMT


@wordofchristian I'm also seeing this (on web) due to the lack of clearing the query params

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by wordofchristian
Monday Feb 06, 2017 at 22:07 GMT


@ChristopherBiscardi I was able to partially solve it by adding the withKnobs decorator to my global storybook config

import {  addDecorator } from '@kadira/storybook';
import { withKnobs } from '@kadira/storybook-addon-knobs';
// add global knobs decorator to fix issue of persistent values between stories
addDecorator(withKnobs);

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by sbaggott
Wednesday Feb 15, 2017 at 21:13 GMT


This is definitely an issue with react web. We are using the withKnobs decorator in our code, but it doesn't prevent the issue with persistent values in the query strings.

@Donaldini
Copy link

I have an issue that seems related, but might not be...

I have a Button component that has a caption property in its own Story.
<Button caption={text('Caption', 'My button')} />

When I create a different component that implements this button I cannot override the original Knob in its Story.

const ButtonWithCancel = (captionProp) => (
    <Button caption={captionProp} /> or <a href="#">cancel</a>
);

<ButtonWithCancel captionProp={text('Caption', 'Save')} />

This last ButtonWithCancel will display My Button and not Save

@shilman shilman added the bug label May 12, 2017
@Billy-
Copy link

Billy- commented Sep 29, 2017

I am also having the same issue... I've only noticed it on components which are connected though, so I though that might be something to do with it.

@stale
Copy link

stale bot commented Nov 14, 2017

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 60 days. Thanks!

@stale stale bot added the inactive label Nov 14, 2017
@stale
Copy link

stale bot commented Nov 29, 2017

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants