You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the updated @storybook/addon-docs package, the tocbot global object is no longer exposed. This prevents documentation sites from running tocbot.refresh for content that is lazy loaded on the page.
Use case: We have some content that is fetched from a remote host on our documentation site that appends a new header to the page. We use this feature to re-init tocbot so the table fo contents update once it has loaded. This was previously exposed in SB8.
Reproduction link
N/A
Reproduction steps
Attempt to call window.tocbot, you will get undefined. This is defined in SB8.
As a result you can no longer call tocbot.refresh.
System
"@storybook/addon-docs": "9.0.0-beta.11"
Additional context
No response
The text was updated successfully, but these errors were encountered:
** Disclaimer** This information might be inaccurate, due to it being generated automatically
The tocbot functionality was previously exposed globally but is now encapsulated. To fix this: 1. In code/addons/docs/src/blocks/DocsContainer.tsx, locate where tocbot is initialized 2. Add this code after tocbot initialization: ts if (typeof window !== 'undefined') { window.tocbot = tocbot; } This will re-expose the tocbot instance globally while maintaining the existing functionality.
About Greptile
This response provides a starting point for your research, not a precise solution.
Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
In the updated
@storybook/addon-docs
package, thetocbot
global object is no longer exposed. This prevents documentation sites from runningtocbot.refresh
for content that is lazy loaded on the page.Use case: We have some content that is fetched from a remote host on our documentation site that appends a new header to the page. We use this feature to re-init tocbot so the table fo contents update once it has loaded. This was previously exposed in SB8.
Reproduction link
N/A
Reproduction steps
window.tocbot
, you will get undefined. This is defined in SB8.tocbot.refresh
.System
Additional context
No response
The text was updated successfully, but these errors were encountered: