-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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]: TypeError: Cannot read properties of undefined (reading 'count') with onClick action #23787
Comments
I have the same error, here are my remarks:
So - from my understanding - it means, the error happens when clicking button right after on page load |
for me it happens whenever I trigger the assigned action, e.g. click the button. |
I get this error as well import type { Meta, StoryObj } from '@storybook/react'
import { Loader2, Mail } from 'lucide-react'
import { Button } from './button'
const meta: Meta<typeof Button> = {
component: Button,
tags: ['autodocs'],
parameters: {
layout: 'centered',
},
argTypes: { onClick: { action: 'clicked' } },
}
export default meta
type Story = StoryObj<typeof Button>
export const Base: Story = {
render: args => <Button {...args}>Button</Button>,
args: {},
} This is the component: https://github.com/shadcn-ui/ui/blob/3c9f7ca0e20638bf75833ef920f9b23f5d97bc71/apps/www/registry/default/ui/button.tsx Doesn't help using |
We're facing the same issue : |
I have a custom event fired, and using argTypes: {
onValueChange: { action: 'onvaluechange' },
}, or even import { actions } from '@storybook/addon-actions';
const eventsFromNames = actions('onValueChange');
args: { ...eventsFromNames } triggers this error |
Same, downgrading |
Related/duplicate: #23741 |
Yeah, that works for now. Unfortunately it's necessary to downgrade all of Storybook to 7.1.1 and not just this addon. Using Storybook 7.2.0 or newer with |
Fixed in latest alpha release by #23804 |
Just updated to Storybook 7.4.0 and I'm still seeing this error. After a manual reload of Storybook, any action that's tracked by the Actions addon starts throwing this error again, until I switch to a different story. Exact same problem as before. |
This is still happening in 7.4.1 as well |
Can confirm that it is still happening in 7.4.1 |
@kasperpeulen looks like this is still broken, I'm observing it in my project as well. |
Is there a reproduction repo anyone could share? |
@ndelangen here's what I learned when trying to reproduce:
Here's a repro: https://stackblitz.com/edit/github-iz1qiv?file=src%2Fstories%2FButton.stories.ts Because you can't reload the page in stackblitz, you'll need to download the project and run locally. |
@IanVS I'm investigating. |
@ndelangen, I think the package-lock.json was created by storybook.new / stackblitz, which runs So, I tried this again as well on a fresh laptop after re-downloading the zip file.
Maybe the difference is that my button story uses the actions addon, and the logged-in page story does not ( |
I guess i should navigate to the button story instead.. I didn't know it had a play function. |
I added one for this reproduction. Sorry, should have made that clearer. |
Describe the bug
To Reproduce
just setup a react app with webpack or vite, then install storybook and create a story for a single button component
System
Additional context
No response
The text was updated successfully, but these errors were encountered: