Commit 8637c59
committed
fix(core): treat relatedRequestId 0 as present in debounce guard
`0` is a valid JSON-RPC RequestId (and is also the first id a
Protocol instance uses). The debounce guard in `Protocol.notification`
used a truthy check `!options?.relatedRequestId` which treated 0 as
absent, and incorrectly coalesced related notifications that should
have bypassed debouncing.
Compare the asymmetry:
| relatedRequestId | debounced? (pre-fix) |
| 0 | YES (bug) |
| 1 | no |
| "0" | no |
Switch to `options?.relatedRequestId == null` - catches anull/undefined, preserves 0 as a valid id.
`relatedTask` is a structured object and cannot be falsy, so its guard
is unchanged.
Closes #2117.1 parent 48251fe commit 8637c59
2 files changed
Lines changed: 20 additions & 1 deletion
File tree
- packages/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1010 | 1010 | | |
1011 | 1011 | | |
1012 | 1012 | | |
1013 | | - | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
1014 | 1017 | | |
1015 | 1018 | | |
1016 | 1019 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
768 | 768 | | |
769 | 769 | | |
770 | 770 | | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
771 | 787 | | |
772 | 788 | | |
773 | 789 | | |
| |||
0 commit comments