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]: Disabled toc in story produces error spam on scroll #27181

Open
SetupCoding opened this issue May 17, 2024 · 0 comments
Open

[Bug]: Disabled toc in story produces error spam on scroll #27181

SetupCoding opened this issue May 17, 2024 · 0 comments

Comments

@SetupCoding
Copy link

SetupCoding commented May 17, 2024

Describe the bug

Console error spam from toc (table of contents), if toc: { disable: true } is set and scrolling is triggered.

index-c882a240.js:442 Uncaught TypeError: Cannot read properties of undefined (reading 'querySelector')
    at Object.v [as updateToc] (index-c882a240.js:442:3110)
    at HTMLDocument.<anonymous> (index-c882a240.js:442:9940)
    at HTMLDocument.<anonymous> (index-c882a240.js:442:8472)

To Reproduce

https://stackblitz.com/edit/github-jmtuvf?file=.storybook%2Fpreview.ts,src%2Fstories%2FButton.stories.ts&preset=node

  1. Open the reproduction example
  2. See enabled toc in preview.tsx
  3. See disabled toc in Button.stories.ts
  4. Go to Storybook Button Docs page
  5. Open Dev tools
  6. Scroll down on the docs page
  7. See error spam in console stemming from toc query selector var oldActiveTocLink = tocElement.querySelector("." + options.activeLinkClass);
Uncaught TypeError: Cannot read properties of undefined (reading 'querySelector')
    at Object.updateToc (chunk-Z2YT5RER.js?v=aaea24c7:257:41)
    at HTMLDocument.<anonymous> (chunk-Z2YT5RER.js?v=aaea24c7:648:16)
    at HTMLDocument.<anonymous> (chunk-Z2YT5RER.js?v=aaea24c7:736:10)

System

Storybook Environment Info:

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm <----- active
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @storybook/addon-essentials: ^8.2.0-alpha.1 => 8.2.0-alpha.1 
    @storybook/addon-interactions: ^8.2.0-alpha.1 => 8.2.0-alpha.1 
    @storybook/addon-links: ^8.2.0-alpha.1 => 8.2.0-alpha.1 
    @storybook/addon-onboarding: ^8.2.0-alpha.1 => 8.2.0-alpha.1 
    @storybook/blocks: ^8.2.0-alpha.1 => 8.2.0-alpha.1 
    @storybook/react: ^8.2.0-alpha.1 => 8.2.0-alpha.1 
    @storybook/react-vite: ^8.2.0-alpha.1 => 8.2.0-alpha.1 
    @storybook/test: ^8.2.0-alpha.1 => 8.2.0-alpha.1 
    storybook: ^8.2.0-alpha.1 => 8.2.0-alpha.1

Additional context

Many thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Empathy Backlog
Development

No branches or pull requests

2 participants