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
Changing controls in storybook for angular components does not trigger ngOnChanges #15610
Comments
In case someone wants to attempt this, here are the files I think are relevant: Method in legacy renderer that called General location this probably needs to be added to: https://github.com/storybookjs/storybook/blob/next/app/angular/src/client/preview/angular-beta/StorybookWrapperComponent.ts#L136 I think I remember discussions from when the new rendering changes were starting that didn't think manually calling I know I hadn't noticed it being missing or thought to check for it, because I try to avoid |
I think I found the problem and why it is happening, but still need to fix it or at least decide what to do about it. The more I think about it the more I am wondering if it is actually wrong, because I think it makes sense why @aavelyn Just to confirm that what I am seeing is correct for you also, is your story passing a For the following component: @Component({ selector: 'foo', template: '{{bar}}' })
class FooComponent implements OnChanges {
@Input() bar: string;
ngOnChanges(changes: SimpleChanges) { }
} I have a test spying on export const Ex = () => ({
props: { bar: '' }
}) Then fails for a story like: export const Ex = () => ({
props: { bar: '' },
template: `<foo></foo>`
}) I think it fails because when a |
Hi @Marklb, |
It also happens to me. I'm migrating from 6.1.21 to 6.3.6 and that feature broke (along with many others) Before, if I change a value in controls it will be updating the component, now... it do nothing. I checked that the ngOnChanges is not triggered. |
I've got a mostly similar problem. Storybook controls don't update the component's inputs.
@Input() set inputArg(arg: string) {
console.log(arg);
this.service.arg = arg;
}
The component will have it's input set initially if the arg is hard-coded in the doc, however subsequent updates never reach the component instance. I see similar behavior if I load the story in an iframe and use the url-arg method |
I have a similar problem. In the React application, Actions are not triggered.
|
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! |
bump |
Had the same issue, but it's actually resolved since version 6.3.16 (#17156). Try an update, I'm currently on 6.3.18 and it works fine. 👍 |
Shiver me timbers!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.52 containing PR #17633 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Egads!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.20 containing PR #17633 that references this issue. Upgrade today to the
|
Up, this is not working in version 6.5.10. Can someone confirm it works on @latest? |
Describe the bug
I've followed the angular tutorial and created a test component.
When I change the controls in storybook, which are wired to trigger changes in angulars
ngOnChanges
lifecycle hook, nothing happens.To Reproduce
@Input
and implement thengOnChanges
lifecycle hook in that component and console.logsimpleChanges
System
Environment Info:
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Binaries:
Node: 16.3.0 - /usr/local/bin/node
npm: 7.15.1 - /usr/local/bin/npm
Browsers:
Chrome: 91.0.4472.114
Firefox: 89.0.2
Safari: 14.0.3
npmPackages:
@storybook/addon-actions: 6.3.4 => 6.3.4
@storybook/addon-controls: 6.3.4 => 6.3.4
@storybook/addon-docs: 6.3.4 => 6.3.4
@storybook/addon-essentials: ~6.3.0 => 6.3.4
@storybook/addon-jest: 6.3.4 => 6.3.4
@storybook/addon-knobs: ~6.3.0 => 6.3.0
@storybook/addon-storysource: 6.3.4 => 6.3.4
@storybook/addon-viewport: 6.3.4 => 6.3.4
@storybook/angular: ~6.3.0 => 6.3.4
@storybook/builder-webpack5: ~6.3.0 => 6.3.4
@storybook/manager-webpack5: ~6.3.0 => 6.3.4
Other relevant dependencies
Additional context
The text was updated successfully, but these errors were encountered: