mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43639 Currently, the `react-native/dev-middleware` inspector proxy intercepts `Debugger.scriptParsed` notifications from the target and replaces `sourceMapURL` with a data uri, via an async fetch from Metro. During this async fetch, other notifications from the debugger may pass through the proxy, which results in the frontend receiving them before `Debugger.scriptParsed`. This reordering causes problems in breakpoint resolution and pausing, because `Debugger.breakpointResolved` and `Debugger.paused` events may reference `scriptId`s unknown to the frontend while the corresponding `Debugger.scriptParsed` is delayed. In particular, breakpoint UI state and backend state can fall out of sync, and breakpoints hit may open to the incorrect source location. This diff modifies the proxy to use a simple per-target promise queue to ensure messages are handled in the order they were received from the target. Changelog: [General][Fixed] Fix breakpoints opening to incorrect location or disappearing from debugger frontend UI. Reviewed By: motiz88 Differential Revision: D55200617 fbshipit-source-id: 27c95f822266875ed668d0bf8a525da49554cafd