Repository navigation
Reload the application once so first-run breakpoints are hit - #2969
Closed
Matteo Boetti (teoboetti) wants to merge 1 commit into
Closed
Matteo Boetti (teoboetti) wants to merge 1 commit into
Matteo Boetti (teoboetti) wants to merge 1 commit into
Conversation
A launch installs and starts the app, which finishes evaluating its bundle well before the CDP proxy manages to attach. Hermes replays scriptParsed on Debugger.enable, so breakpoints registered for that first run resolve and look bound, but the code they belong to has already executed and they are never reached. Reloading by hand makes them work, which is what users hit today. Hermes has no pause-on-load to wait for: it answers Runtime.runIfWaitingForDebugger with "Unsupported method" (-32601), so the only lever is to run the bundle again once the debugger is ready. Send a single Page.reload after the debugger goes quiet following its initial breakpoint requests. Reloads are driven by the device (the nativePageReloads capability), so the debugger stays attached and the breakpoints re-bind. The request is sent out of band with an id the debugger never issued, so it discards the reply as an unknown response id. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Author
|
Closing for now — moving this to my own fork while I run it against more projects. Happy to reopen once it has more mileage. |
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.
Breakpoints set before the first run of a
reactnativedirectsession are never hit. Reloading the app by hand makes the same breakpoints work, which is the workaround users land on today.Cause
A launch installs and starts the app, which finishes evaluating its bundle well before the CDP proxy manages to attach. Hermes replays
Debugger.scriptParsedonDebugger.enable, so breakpoints registered for that first run resolve and look bound in the UI — but the code they belong to has already executed, so nothing stops.There is no pause-on-load to wait for. Hermes answers
Runtime.runIfWaitingForDebuggerwith:{"error":{"code":-32601,"message":"Unsupported method 'Runtime.runIfWaitingForDebugger'"},"id":1}so the only lever is to run the bundle again once the debugger is ready.
Change
HermesCDPMessageHandlersends a singlePage.reloadafter the debugger goes quiet following its initialDebugger.setBreakpointByUrl/Debugger.setBreakpointrequests (300 ms debounce, once per session, cancelled onclose).Reloads are driven by the device — the
nativePageReloadscapability reported in/json/list— so the debugger stays attached across the reload and the breakpoints re-bind. Verified against a live RN 0.87.1 iOS target:The request is sent out of band with an id the debugger never issued, so js-debug discards the reply via the unknown-response-id path in
_processResponserather than mis-attributing it.If no breakpoints are set at launch, no reload is sent.
Validation
tsc --noEmitclean,gulp lintreports no new warningsnpm test— 465 passing, 0 failing (runnpx gulpfirst, otherwise thecommandsRegisteredtest fails on a missingdist/rn-extension)test/cdp-proxy/hermesCDPMessageHandler.test.ts: reload fires, a burst coalesces into one, no second reload per session, cancelled on disconnect, breakpoint passthrough unaffectedNote
Independent of #2782 and touches no files in common, but in practice both are needed on RN >= 0.76: without #2782 the proxy never connects at all, so there is no session in which this reload could help.