fix: snapshot RN synthetic events and prevent channel echo#856
Merged
Conversation
- Add patchChannelForRN to snapshot synthetic event args before React recycles them, avoiding stale event pool errors in the actions panel - Limit channel serialization depth to prevent circular reference crashes - Stop WebSocket server from echoing messages back to the sender - Fix polyfill.ts import to use react-native instead of react-native-web - Move setImmediate workaround from Start.tsx to polyfill.ts
|
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.
Summary
patchChannelForRNwhich snapshots React Native synthetic event args synchronously before React recycles them back to the event poolpolyfill.tsimport fromreact-native-webtoreact-nativesetImmediateworkaround fromStart.tsxtopolyfill.tswhere it belongsProblem
React Native still pools synthetic events (unlike React DOM 17+). When action events containing synthetic event args were serialized asynchronously by the channel transport, the events had already been returned to the pool — causing stale event warnings, serialization errors, or crashes from circular references in deep object graphs.
Additionally, the WebSocket server was broadcasting messages back to the sender, causing duplicate event processing.
Test plan