Repository navigation
MBA-2266 (1/6): Node 20 + React 18, remove all 60 deprecated lifecycle calls - #8
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ Description of Change
Link to GitHub issue or Jira ticket: MBA-2266
Description:
PR 1 of 6 of the
src/jscleanup program. Scope is only the runtime/toolchain move to Node 20 + React 18 and the removal of the deprecated lifecycle calls. The duplicate-library convergence (react-table 6, react-final-form, moment, react-virtualized, font-awesome 4) is untouched here and lands in PRs 2-5.Toolchain / deps
engines: Node^14→^20, npm^6 || ^7→^10.react/react-dom16.8.6 → 18.3.1,react-redux7.1.3 → 8.1.3 (7.x does not support the React 18 renderer).@testing-library/react12 → 14 (which absorbsrenderHook, so@testing-library/react-hooksis dropped),react-test-renderer→ 18.3.1,@types/react-dom→ 18.3.7.Root + imports
src/js/index.jsx:ReactDOM.render(<App/>, node)→createRoot(node).render(<App/>).react-redux/es/...imports (index.jsx,MainRouter.jsx,put-away/SplitLineModal.jsx) → public{ connect }/{ Provider }. react-redux 8 ships noes/entry points, so these were hard build breaks.<StrictMode>. Double-invocation behavior is only meaningfully verifiable against a running app, which is PR 6's browser session; enabling it blind here would be an unverified claim.The 60 deprecated lifecycle calls
All 60
componentWillReceivePropsmethods are gone — rewritten, not renamed toUNSAFE_.grep -rn "componentWillReceiveProps\|componentWillMount\|componentWillUpdate\|UNSAFE_" src/jsnow returns nothing.Two recipes were applied. Side-effecting bodies (the large majority — locale-change refetches,
dataFetchedone-shot guards, location-change refetches) becamecomponentDidUpdate(prevProps)with the props references inverted:Note that the inner guard becomes
prevProps— it asks "did we already have a locale", not "do we have one now". Getting that backwards would turn "refetch on language switch" into "refetch on first locale arriving", so every guard was read individually rather than search-replaced.Bodies that purely derive state from props (
attrfromfieldConfig+getDynamicAttrin the receiving/packing/substitution/adjust-inventory/edit-pick modals) becamestatic getDerivedStateFromProps(props), which has no unconditional-setStatehazard.Where a body setStated unconditionally and could not be pure derivation (
put-away/PutAwayCheckPage,put-away/PutAwaySecondPage), an explicit_.isEqualchange guard was added — an unconditionalsetStateinsidecomponentDidUpdateis an infinite render loop, unlike insidecomponentWillReceiveProps.stock-list-management/StocklistManagementalready had acomponentDidUpdate; the converted logic was merged into it rather than declared twice.Class components were left as classes; no conversions to function components.
React 18 behavior fixes
Three genuine React 18 breakages, not API renames:
Filter/FilterForm—countFilledsetState'd during render (legal-ish in 16, an update loop in 18). It is now a pure function andamountFilledis a localconstin the render callback.GlobalSearch+Layout/NavbarIcons—renderButtoncalledsetIsTooltipDisabledduring render. Visibility is now published through anonVisibilityChangeprop fired from auseEffect.receiving/ReceivingCheckScreen— under 18's automatic batching the spinner outlived the data load;hideSpinner()now runs in thesetStatecallback.Tests
src/js/tests/hooks/*files importrenderHook/actfrom@testing-library/react.<div></div>→<div />, one trailing blank line), no behavioral output change.MainRouter(language switch refetches translations + menu config, and the first locale arriving does not),Layout/VerticalTabs(activeTabresets when the tab set size changes),receiving/modals/EditLineModal(attrderivation).Bundle size (sum of emitted
.js+.css, source maps excluded)develop@ 4b703b8React 18's runtime is larger than 16.8's; this PR adds a library rather than removing one. The reductions in the ticket come from PRs 2-5, which delete one half of each duplicated library pair.
Devin-Org: engineering
Link to Devin session: https://app.devin.ai/sessions/c12d7fc2c18d47b3ad290cb76769412f
Open in Devin Desktop: https://app.devin.ai/desktop/session/c12d7fc2c18d47b3ad290cb76769412f?variant=devin