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

[Bug]: Angular StorybookWrapper doesn't found ChangeDetectionRef #20965

Closed
jadeen opened this issue Feb 6, 2023 · 2 comments · Fixed by #20983
Closed

[Bug]: Angular StorybookWrapper doesn't found ChangeDetectionRef #20965

jadeen opened this issue Feb 6, 2023 · 2 comments · Fixed by #20983

Comments

@jadeen
Copy link

jadeen commented Feb 6, 2023

Describe the bug

I have tried to create the following story with angular component from my library

import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { Meta, moduleMetadata, StoryObj } from '@storybook/angular';

import { SekInputListComponent } from 'component';

const meta: Meta<SekInputListComponent> = {
  title: 'Button',
  component: SekInputListComponent,
  decorators: [
    moduleMetadata({
      imports: [ReactiveFormsModule],
      schemas: [CUSTOM_ELEMENTS_SCHEMA]
    }),
  ],
  argTypes: {
    placeholder: { control: 'text' },
  }
};

export default meta;

type Story = StoryObj<SekInputListComponent>;

export const Primary: Story = {
  render: () => ({
    props: {
      placeholder: 'Test'
    },
  }),
};

component is a typescript path of the build version of my library.

When I visited the page of my story, the following error happened

core.mjs:8506 ERROR TypeError: Cannot read properties of undefined (reading 'detectChanges')
    at SafeSubscriber._next (StorybookWrapperComponent.js:76:1)
    at SafeSubscriber.__tryOrUnsub (Subscriber.js:183:1)
    at SafeSubscriber.next (Subscriber.js:122:1)
    at Subscriber._next (Subscriber.js:72:1)
    at Subscriber.next (Subscriber.js:49:1)
    at StorybookProvider.js:16:1
    at _ZoneDelegate.invoke (zone.js:411:1)
    at Object.onInvoke (core.mjs:24313:1)
    at _ZoneDelegate.invoke (zone.js:411:1)
    at Zone.run (zone.js:169:1)

To Reproduce

You can find a github repo with the issue [here](https://github.com/jadeen/storybook-issue)

System

  System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  Binaries:
    Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
    npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
  Browsers:
    Chrome: 109.0.5414.74
    Firefox: 109.0.1
  npmPackages:
    @storybook/addon-actions: 7.0.0-beta.41 => 7.0.0-beta.41 
    @storybook/addon-controls: 7.0.0-beta.41 => 7.0.0-beta.41 
    @storybook/addon-docs: 7.0.0-beta.41 => 7.0.0-beta.41 
    @storybook/addon-essentials: 7.0.0-beta.41 => 7.0.0-beta.41 
    @storybook/addon-interactions: 7.0.0-beta.41 => 7.0.0-beta.41 
    @storybook/addon-links: 7.0.0-beta.41 => 7.0.0-beta.41 
    @storybook/addon-measure: 7.0.0-beta.41 => 7.0.0-beta.41 
    @storybook/addon-storysource: 7.0.0-beta.41 => 7.0.0-beta.41 
    @storybook/addon-viewport: 7.0.0-beta.41 => 7.0.0-beta.41 
    @storybook/addons: 7.0.0-beta.41 => 7.0.0-beta.41 
    @storybook/angular: 7.0.0-beta.41 => 7.0.0-beta.41 

Additional context

No response

@jadeen
Copy link
Author

jadeen commented Feb 6, 2023

I have updated the issue with a link to a repo with the issue. I think I have the issue because my component is standalone.

@shilman
Copy link
Member

shilman commented Feb 7, 2023

Whoopee!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.44 containing PR #20983 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb@next upgrade --prerelease

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

Successfully merging a pull request may close this issue.

4 participants