docs(storybook): fix blank content in Safari (DS-5437) - #459
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesDark Mode Integration
Estimated code review effort: 2 (Simple) | ~5 minutes Merge Risk: ⚪ Minimal · up to This is a localized Storybook documentation fix, and no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 14 UNAVAILABLE: read ECONNRESET Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Visit the preview URL for this PR (updated for commit d2941d5): https://react-koobiq-next--prs-459-zbo9eydz.web.app (expires Wed, 19 Aug 2026 11:46:43 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: fc29847d4a9e5cb1adf458c76a9b681c76e2eeff |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where documentation pages rendered blank in Safari within the Storybook docs container. Previously, DocContainer initialized its dark-mode state via useState() (undefined by default) and only populated it after receiving a DARK_MODE_EVENT_NAME channel event, returning null until then. In Safari, that event apparently did not fire reliably, so the guard if (!themeIsMounted) return null left the content blank. The change replaces the manual channel subscription with the addon's own useDarkMode() hook, which returns the current dark-mode state synchronously, so content renders immediately.
Changes:
- Replaced manual
addons.getChannel()+DARK_MODE_EVENT_NAMEsubscription anduseState/useEffectwith theuseDarkMode()hook. - Removed the
themeIsMountedgate that returnednull, allowing documentation to render immediately. - Cleaned up now-unused imports (
useEffect,useState,isNotNil,DARK_MODE_EVENT_NAME,addons).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary by CodeRabbit