[test] Fix react@18/next nightly workflow#48635
Draft
Janpot wants to merge 1 commit into
Draft
Conversation
Deploy previewhttps://deploy-preview-48635--material-ui.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
96aaf43 to
b902ae0
Compare
- test_regressions: the 'A11y results committed?' check ran an unscoped git diff, but the react@17/18/next jobs pin React via package-overrides, which dirties package.json/pnpm-lock.yaml. Exclude those two files so the check still verifies the a11y results on every job. - ListItem: type slotProps.root as SlotProps so it accepts a callback (matches the conformance slotProps-callback test); regenerated propTypes + API docs. - Tab: the conformance theme tests wrap the element in a provider; slot Tabs inside that wrapper so Tabs clones the Tab(s), not the provider. Cloning the provider with Tab-internal props (fullWidth, indicator, …) tripped its exactProp check under React 18. TODO marks it for removal once React 18 is dropped (React 19 has no runtime exactProp validation). - useValueAsRef: compare the ref captured after each render settles so React 18 StrictMode's discarded initial-mount object doesn't skew the identity check.
063a533 to
7c53929
Compare
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.
Fixes the
react@18andreact@nextnightly CI matrix, which was red across the unit, browser, and visual-regression jobs onmaster. Each failure is React-version-specific, so they don't surface on the default (React 19 stable) PR runs.test_regressions(react@17/18/next) — the "A11y results committed?" step ran an unscopedgit diff --exit-code, but these jobs pin React viapackage-overrides, which rewritespackage.json/pnpm-lock.yamland tripped the check. Those two files are now excluded from the check (:(exclude)…), so it still verifies the a11y results on every matrix job instead of being skipped.ListItem—slotProps.rootwas typed as plainHTMLAttributes, so the generated propType wasPropTypes.objectand rejected the callback form that the conformanceslotProps.roottest passes (a warning under React 18, which still validates propTypes). Typed it asSlotPropslike the other slots and regenerated propTypes + API docs.Tab—Tabmust render as a direct child ofTabs, which injects state into its children viacloneElement(fullWidth,indicator,selected, …). The theme conformance tests wrap the element in aThemeProvider, and the old test render made that provider a direct child ofTabs— soTabscloned the provider withTab-internal props, tripping itsexactPropcheck under React 18. The test render now slotsTabsinside the wrapper (ThemeProvider > Tabs > Tab), matching real-world usage, so the provider is never cloned. This keeps every conformance test (and the documentedthemeDefaultPropscapability) intact rather than skipping them. It's a React-18-only workaround (React 19 dropped runtimeexactPropvalidation) — a TODO marks it for removal once React 18 leaves the matrix.useValueAsRef— the ref-identity test latched its first reference during the initial render, capturing the transient object that React 18 StrictMode discards on its mount/remount. It now compares the ref captured after each render settles.Verified locally against both React 18.3.1 and React 19.2.6 (node and chromium).
Note: the
InitColorSchemeScriptreact@nextfailures from the same nightly are already handled by #48604.