Commit 301abfe
authored
fix(network-activity-plugin): race condition when reloading the app (#235)
## Summary
- Adds a `recording-state` event sent by the React Native side to the
DevTools UI on every new connection, broadcasting the current recording
state.
- The DevTools UI listens for this event and re-syncs its recording
toggle by sending `network-enable` or `network-disable` if the states
diverge.
- This fixes a race condition where reloading the app could leave the UI
and the native side out of sync (e.g. UI shows recording enabled but
native has reset to disabled).
## Test plan
- [ ] Start the app with network recording enabled, reload the app, and
verify the DevTools UI stays in sync with the native recording state.
- [ ] Toggle recording off, reload the app, and confirm the UI reflects
the disabled state.
- [ ] Verify no regressions in normal network recording start/stop flow.1 parent 0b373c7 commit 301abfe
3 files changed
Lines changed: 22 additions & 0 deletions
File tree
- packages/network-activity-plugin/src
- react-native
- ui/state
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
102 | 108 | | |
103 | 109 | | |
104 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
126 | 136 | | |
127 | 137 | | |
128 | 138 | | |
| |||
583 | 593 | | |
584 | 594 | | |
585 | 595 | | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
586 | 599 | | |
587 | 600 | | |
588 | 601 | | |
| |||
0 commit comments