Skip to content

fix: preserve reactStrictMode when configure() omits it - #1474

Open
nimbly1 wants to merge 1 commit into
testing-library:mainfrom
nimbly1:pr/configure-preserve-react-strict-mode
Open

nimbly1 wants to merge 1 commit into
testing-library:mainfrom
nimbly1:pr/configure-preserve-react-strict-mode

Conversation

@nimbly1

@nimbly1 nimbly1 commented Oct 27, 2026

Copy link
Copy Markdown

Fixes #1466

Problem

configure() in src/config.js destructured reactStrictMode out of the new config and always wrote it back. When a caller configured only other options, the destructured value was undefined, so a previously configured reactStrictMode: true was silently reset to undefined:

configure({reactStrictMode: true})
configure({testIdAttribute: 'not-data-testid'})
getConfig().reactStrictMode // undefined, expected true

Change

Keep the existing value when the new config does not provide one:

reactStrictMode: reactStrictMode ?? configForRTL.reactStrictMode,

Explicitly passing reactStrictMode: true or false still overwrites it, and the function form of configure() behaves as before.

Test

Added configure without reactStrictMode preserves the existing value in src/__tests__/config.js. It sets reactStrictMode: true, configures an unrelated option, asserts the value is still true, then asserts an explicit false still applies.

  • Before the fix, the new test fails at expect(getConfig().reactStrictMode).toBe(true).
  • After the fix: full Jest suite passes (249 passed, 3 skipped), and npm run lint and npm run typecheck are clean.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-27T00:58:43.925512Z
We couldn’t complete this review. Comment @codex review to try again.
3b551ca Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@nimbly1

nimbly1 commented Oct 27, 2026

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: calling configure() without reactStrictMode resets it to undefined, silently disabling strict mode

1 participant