-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Knobs-addon: Angular Components lose interactivity after adjusting property via knob #7242
Comments
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 30 days. Thanks! |
We are using storybook with a custom component-library and just stumbled upon this issue. |
I've also tested 5.1.10, and down to 5.1.5, than reverted back. |
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 30 days. Thanks! |
@sebastian-marinescu @rkara your storybook behavior most likely caused by fix of that issue #4098 |
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 30 days. Thanks! |
I'm still seeing this issue in 5.2.5. tried with 5.3.0-alpha.34, but the knob wasn't showing up at all! I think that's a different issue though... edit: I'm only seeing this issue when using addon-docs. That might change things |
I believe the problem involves code being run outside the angular zone, which causes change detection to not be run correctly. In the function that makes changes that should be detected, I added |
Hi everyone, Steps to reproduce the behavior:
storiesOf("COMPONENTS|button", module)
.addDecorator(withKnobs)
.add("basic", () => ({
template: `
<button *ngIf="visible" (click)="clickHandler($event);toggleState=!toggleState;">
State: {{ toggleState }}
</button>`,
props: {
visible: boolean("visible", true),
clickHandler: action("click event"),
},
})); That happens with all components with System:
Any help is appreciated. Thanks. |
Just checked that with the official sample (storybook/examples/angular-cli v6.0.0-alpha.33). But it works with v5.0.11 |
Hi everyone, Is there any news there? Thanks. |
Hi, Any workaround for this issue ? Thanks. |
Hi gang, We’ve just released addon-controls in 6.0-beta! Controls are portable, auto-generated knobs that are intended to replace addon-knobs long term. Please upgrade and try them out today. Thanks for your help and support getting this stable for release! |
For anybody who is interested in Controls but don't know where to start, I've created a quick & dirty step-by-step walkthrough to go from a fresh CRA project to a working demo. Check it out: => Storybook Controls w/ CRA & TypeScript There are also some "knobs to controls" migration docs in the Controls README: |
Hi guys, |
@mgameover thanks for testing that--great to hear that it works! will accept PRs for fixes in knobs. SB6 going into RC soon. i'll be maintaining controls, and looking for knobs maintainers since we're not deprecating that yet |
Hi all, I've found a workaround. Use functions!! ...
.add('your story here', () => ({
template: `
<your-component-here
[customHeight]="height()">
</your-component-here>
`,
props: {
height: () => number('height', 50)
},
})); |
Hi all, |
Hi there, |
@igorbaimos Is that I started a PR(#12382) that fixes this problem without needing the workaround, but I am not positive that it is the right way to solve this, so if anyone knows how When I read @literalpie's comment(#7242 (comment)) about how a function was not being called inside an NgZone it gave me an idea what the problem was. By making sure the props are always run from inside the zone, it seems to fix the problem. What I think is happening without the PR is the following:
Based on the steps I mentioned above, the code in #7242 (comment) wouldn't work after toggling the boolean knob. When the If anything I said is wrong, let me know, because I am basing my PR on that logic. |
@Marklb My knob is defined as follows
Note: if I don't use function as knob definition the |
Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.0-alpha.0 containing PR #12382 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Describe the bug
When adjusting properties on an Angular component via a Knob, the Angular component interactions start having issues.
To Reproduce
Steps to reproduce the behavior:
The example leverages
@angular/material
, but I came across this via proprietary components as well.Expected behavior
Component should continue to work as expected after changing property via knob.
Code snippets
System:
@storybook/addon-knobs
The text was updated successfully, but these errors were encountered: