UI: Fix mobile navigation when renderLabel returns a React node#34262
Conversation
6fcb64a to
2cd0cf2
Compare
When renderLabel returns a React node instead of a string, the mobile navigation bottom bar displays [object Object] due to template literal string coercion. This checks the return type and falls back to .name when the result is not a string, matching the behavior the user expects. Closes #34261
2cd0cf2 to
d7f47f6
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR extends MobileNavigation's renderLabel support to handle ReactNode return types alongside strings. A new Story export ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
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 Tip You can disable sequence diagrams in the walkthrough.Disable the |
Summary
Fixes #34261
When
sidebar.renderLabelreturns a React node (supported on desktop sidebar), the mobile bottom bar built a breadcrumb string via template literals, coercing nodes to[object Object].Changes
useFullStoryName, userenderLabeloutput only when it is astring; otherwise fall back tonamefor the current story and each parent in the path.ReactNodeRenderLabelto cover non-stringrenderLabel(regression guard for Chromatic / manual QA).How to test
Mobile/Navigation→ReactNodeRenderLabelin the internal Storybook).component/story(plain names), not[object Object].Notes for reviewers
Summary by CodeRabbit
Bug Fixes
Tests