Skip to content

Use lazy TurboModule lookup for Clipboard in LogBoxInspector (#56199)#56199

Closed
seantarzy wants to merge 1 commit intofacebook:mainfrom
seantarzy:export-D97008263
Closed

Use lazy TurboModule lookup for Clipboard in LogBoxInspector (#56199)#56199
seantarzy wants to merge 1 commit intofacebook:mainfrom
seantarzy:export-D97008263

Conversation

@seantarzy
Copy link
Copy Markdown
Contributor

@seantarzy seantarzy commented Mar 23, 2026

Summary:

D95277489 added a Copy button to LogBoxInspector that imports
Clipboard, which calls TurboModuleRegistry.getEnforcing('Clipboard')
at module load time. In environments where the native Clipboard module
is not available (e.g., Fantom integration tests), this throws and
crashes the entire test file (LogBox-itest.fb.js).

Replace the static Clipboard import with a lazy
TurboModuleRegistry.get() call at invocation time, which returns
null when the module is unavailable instead of throwing.

Changelog: [Fixed][LogBox] - Fix crash when Clipboard module is unavailable

Reviewed By: NickGerleman

Differential Revision: D97008263

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 23, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Mar 23, 2026

@seantarzy has exported this pull request. If you are a Meta employee, you can view the originating Diff in D97008263.

@seantarzy seantarzy force-pushed the export-D97008263 branch 2 times, most recently from 10fc81f to 1b638dc Compare March 23, 2026 21:02
@meta-codesync meta-codesync bot changed the title Use lazy TurboModule lookup for Clipboard in LogBoxInspector Use lazy TurboModule lookup for Clipboard in LogBoxInspector (#56199) Mar 23, 2026
seantarzy added a commit to seantarzy/react-native that referenced this pull request Mar 23, 2026
…k#56199)

Summary:

D95277489 added a Copy button to LogBoxInspector that imports
`Clipboard`, which calls `TurboModuleRegistry.getEnforcing('Clipboard')`
at module load time. In environments where the native Clipboard module
is not available (e.g., Fantom integration tests), this throws and
crashes the entire test file (`LogBox-itest.fb.js`).

Replace the static `Clipboard` import with a lazy
`TurboModuleRegistry.get()` call at invocation time, which returns
`null` when the module is unavailable instead of throwing.

Changelog: [Fixed][LogBox] - Fix crash when Clipboard module is unavailable

Reviewed By: NickGerleman

Differential Revision: D97008263
seantarzy added a commit to seantarzy/react-native that referenced this pull request Mar 23, 2026
…k#56199)

Summary:

D95277489 added a Copy button to LogBoxInspector that imports
`Clipboard`, which calls `TurboModuleRegistry.getEnforcing('Clipboard')`
at module load time. In environments where the native Clipboard module
is not available (e.g., Fantom integration tests), this throws and
crashes the entire test file (`LogBox-itest.fb.js`).

Replace the static `Clipboard` import with a lazy
`TurboModuleRegistry.get()` call at invocation time, which returns
`null` when the module is unavailable instead of throwing.

Changelog: [Fixed][LogBox] - Fix crash when Clipboard module is unavailable

Reviewed By: NickGerleman

Differential Revision: D97008263
seantarzy added a commit to seantarzy/react-native that referenced this pull request Mar 23, 2026
…k#56199)

Summary:
Pull Request resolved: facebook#56199

D95277489 added a Copy button to LogBoxInspector that imports
`Clipboard`, which calls `TurboModuleRegistry.getEnforcing('Clipboard')`
at module load time. In environments where the native Clipboard module
is not available (e.g., Fantom integration tests), this throws and
crashes the entire test file (`LogBox-itest.fb.js`).

Replace the static `Clipboard` import with a lazy
`TurboModuleRegistry.get()` call at invocation time, which returns
`null` when the module is unavailable instead of throwing.

Changelog: [Fixed][LogBox] - Fix crash when Clipboard module is unavailable

Reviewed By: NickGerleman

Differential Revision: D97008263
seantarzy added a commit to seantarzy/react-native that referenced this pull request Mar 23, 2026
…k#56199)

Summary:

D95277489 added a Copy button to LogBoxInspector that imports
`Clipboard`, which calls `TurboModuleRegistry.getEnforcing('Clipboard')`
at module load time. In environments where the native Clipboard module
is not available (e.g., Fantom integration tests), this throws and
crashes the entire test file (`LogBox-itest.fb.js`).

Replace the static `Clipboard` import with a lazy
`TurboModuleRegistry.get()` call at invocation time, which returns
`null` when the module is unavailable instead of throwing.

Changelog: [Fixed][LogBox] - Fix crash when Clipboard module is unavailable

Reviewed By: NickGerleman

Differential Revision: D97008263
…k#56199)

Summary:
Pull Request resolved: facebook#56199

D95277489 added a Copy button to LogBoxInspector that imports
`Clipboard`, which calls `TurboModuleRegistry.getEnforcing('Clipboard')`
at module load time. In environments where the native Clipboard module
is not available (e.g., Fantom integration tests), this throws and
crashes the entire test file (`LogBox-itest.fb.js`).

Replace the static `Clipboard` import with a lazy
`TurboModuleRegistry.get()` call at invocation time, which returns
`null` when the module is unavailable instead of throwing.

Changelog: [Fixed][LogBox] - Fix crash when Clipboard module is unavailable

Reviewed By: NickGerleman

Differential Revision: D97008263
@meta-codesync meta-codesync bot closed this in a06153c Mar 25, 2026
@facebook-github-tools facebook-github-tools bot added the Merged This PR has been merged. label Mar 25, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Mar 25, 2026

This pull request has been merged in a06153c.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @seantarzy in a06153c

When will my fix make it into a release? | How to file a pick request?

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants