Skip to content

Refactor RCT_handleKeyCommand to avoid concurrency issues#42708

Closed
cipolleschi wants to merge 1 commit into
react:mainfrom
cipolleschi:export-D53186262
Closed

Refactor RCT_handleKeyCommand to avoid concurrency issues#42708
cipolleschi wants to merge 1 commit into
react:mainfrom
cipolleschi:export-D53186262

Conversation

@cipolleschi

Copy link
Copy Markdown
Contributor

Summary:
When pressing r on simulator in Bridgeless mode, we have a race condition between:

  • RCTKeyCommands evaluating the blocks to be invoked
  • ReactNative invalidating the DevMenu with the list of RCTKeyCommands (on which ReactNative is iterating).

The fix checks which commands need to be executed, stores them in an array and then iterates on the array, which is local to the function call, avoiding any concurrency issue.

Changelog:

[iOS][Fixed] - Refactored RCT_handleKeyCommand to avoid concurrency issues

Reviewed By: motiz88

Differential Revision: D53186262

@facebook-github-bot facebook-github-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 Jan 29, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53186262

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53186262

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53186262

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53186262

Summary:

When pressing `r` on simulator in Bridgeless mode, we have a race condition between:
- RCTKeyCommands evaluating the blocks to be invoked
- ReactNative invalidating the DevMenu with the list of RCTKeyCommands (on which ReactNative is iterating).

The fix checks which commands need to be executed, stores them in an array and then iterates on the array, which is local to the function call, avoiding any concurrency issue.

## Changelog:
[iOS][Fixed] - Refactored RCT_handleKeyCommand to avoid concurrency issues

Reviewed By: motiz88

Differential Revision: D53186262
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53186262

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 30, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in 8d710bf.

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. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants