fix(Toolbar filter): Fixed null exception in Toolbar filter#12352
fix(Toolbar filter): Fixed null exception in Toolbar filter#12352dlabaj merged 2 commits intopatternfly:mainfrom
Conversation
|
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 (1)
WalkthroughNull-safe changes to ToolbarFilter's portal target derivation for both collapsed and expanded states; added tests to ensure ToolbarFilter renders when related ref targets are null or when not nested under Toolbar/ToolbarContent. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Preview: https://pf-react-pr-12352.surge.sh A11y report: https://pf-react-pr-12352-a11y.surge.sh |
| {showToolbarItem && <ToolbarItem {...props}>{children}</ToolbarItem>} | ||
| {labelGroupContentRef?.current?.firstElementChild !== null && | ||
| ReactDOM.createPortal(labelGroup, labelGroupContentRef.current.firstElementChild)} | ||
| {collapsedLabelPortalTarget != null && ReactDOM.createPortal(labelGroup, collapsedLabelPortalTarget)} |
| return ( | ||
| <Fragment> | ||
| {showToolbarItem && <ToolbarItem {...props}>{children}</ToolbarItem>} | ||
| {labelContainer != null && ReactDOM.createPortal(labelGroup, labelContainer)} |
|
Your changes have been released in:
Thanks for your contribution! 🎉 |
What: Closes #12267
Summary
Fixes a crash in
ToolbarFilterwhen label portal targets are missing or not yet mounted (#12267).Changes
labelGroupContentRef.current.firstElementChildresolves to a real node (fixes incorrect!== nullchecks vsundefined).labelContainerRefso default / unset context does not throw on first render.Tests
ToolbarFilter.test.tsxfor default context andlabelGroupContentRef.current === nullwhile collapsed.Summary by CodeRabbit
Bug Fixes
Tests
Chores