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

[Hotfix] Seeing knobs from previously selected story #45

Merged

Conversation

mgameover
Copy link

Original issue: #19

Short description:
In Storybook v6.4 disconnectCallbacks is invoked before STORY_CHANGED event has been emitted. As the result the knobs are not being reset.
Fix: reset knobs in disconnectCallbacks function.

Copy link

@luispied luispied left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@koga73
Copy link

koga73 commented Nov 4, 2022

I have confirmed that this fixes the issue! When will this be released?

@xenostar
Copy link

Is there any intention to merge this?

@koga73
Copy link

koga73 commented Jan 14, 2023

Is there any intention to merge this?

Not sure I don't think they are maintaining this anymore unfortunately. But I forked and implemented the fix if you want it.
https://www.npmjs.com/package/@koga73/addon-knobs

@literalpie
Copy link
Collaborator

@JReinhold To be clear, we discussed this issue in #48, but I did not include this fix in my changes, so I think this is still worth merging/releasing.

Here's a before/after in SB7 if it helps gain confidence.
Before:
sb-knob-bug-before
After:
sb-knob-bug-after

@JReinhold JReinhold added bug Something isn't working patch Increment the patch version when merged labels Apr 4, 2023
@JReinhold JReinhold merged commit f0dc860 into storybookjs:next Apr 4, 2023
@fljot
Copy link

fljot commented Apr 26, 2023

@JReinhold any plans to make another release? This wasn't included in 7.0.0 :(

@literalpie
Copy link
Collaborator

We should also make dependencies looser before making a new release.

@JReinhold
Copy link
Contributor

sorry folks, something got messed up in the automation flow. This should now be released in 7.0.2, along with the looser dependencies.

https://github.com/storybookjs/addon-knobs/releases/tag/v7.0.2

@fljot
Copy link

fljot commented May 3, 2023

@mgameover @literalpie
Though fix is generally great and helps, there's still a minor defect in knobs count:
image
e.g. here it shows 9 from a previous story, but updates to proper value once you use any of knob or toggle addon panel.
Not a biggie, just reporting.

@Terrel007
Copy link

@JReinhold Could you please help to release the fix for @storybook/addon-knobs v6.4.0?

@AlexSkrypnyk
Copy link

@JReinhold
Some of us are still stuck on v6 of Storybook. Could you please create a 6.4.* release with this patch back ported. Happy to sponsor this work if required. Thank you

@JReinhold
Copy link
Contributor

I no longer maintain this addon. @literalpie has been keeping it afloat, maybe he's interested in backporting, maybe not.

@literalpie
Copy link
Collaborator

Hi @AlexSkrypnyk this repo isn't set up to do backporting, but since this is a one-line change you could probably get what you need using patch-package (or the similar tools built in to pnpm and modern yarn).

The change will be on line 87 of node_modules/@storybook/addon-knobs/dist/registerKnobs.js

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working patch Increment the patch version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants