MM-69835 Replace legacy context API with modern one - #9
Conversation
|
@coderabbitai Review this |
|
✅ Action performedReview finished.
|
📝 WalkthroughWalkthroughThe PR replaces legacy React context declarations and child-context methods with named context objects, providers, ChangesReact context migration
Estimated code review effort: 4 (Complex) | ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/Nav.js`:
- Around line 347-360: Wrap NavWithContext with React forwardRef, update its
signature to receive the forwarded ref, and pass ref={ref} to the inner Nav
component. Preserve the existing context retrieval, props spreading, and bsClass
export behavior.
In `@src/Panel.js`:
- Around line 87-100: Update the ID-generation guard in the Panel logic around
eventKey, id, and idKey so generation runs only when an identifier is actually
present, including excluding undefined. Preserve the existing getId selection
and headingId/bodyId creation for valid identifiers, while leaving ids unset
when both props are absent.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8581677c-27e0-4822-a61f-75edf7ca6701
📒 Files selected for processing (32)
src/ControlLabel.jssrc/FormControl.jssrc/FormControlFeedback.jssrc/FormGroup.jssrc/FormGroupContext.jssrc/Modal.jssrc/ModalContext.jssrc/ModalHeader.jssrc/Nav.jssrc/Navbar.jssrc/NavbarBrand.jssrc/NavbarCollapse.jssrc/NavbarContext.jssrc/NavbarHeader.jssrc/NavbarToggle.jssrc/Panel.jssrc/PanelBody.jssrc/PanelCollapse.jssrc/PanelContext.jssrc/PanelFooter.jssrc/PanelGroup.jssrc/PanelGroupContext.jssrc/PanelHeading.jssrc/PanelTitle.jssrc/PanelToggle.jssrc/TabContainer.jssrc/TabContainerContext.jssrc/TabContent.jssrc/TabContentContext.jssrc/TabPane.jstest/OverlayTriggerSpec.jstest/index.js
💤 Files with no reviewable changes (2)
- test/OverlayTriggerSpec.js
- test/index.js
Summary
The next part of updating this for React 19 is to get rid of all usage of the now-deprecated legacy context API. Instead of using
contextTypes/childContextTypes/getChildContext, we now useReact.createContextto make provider components along withuseContextin function components and the slightly differentcontextTypein class components.Ticket Link
https://mattermost.atlassian.net/browse/MM-69835