Commit 89d1a79
fix(react): Remove unused
The `react.componentStack` event context set by `captureReactException`
on every captured error never gets sourcemaps applied, so the string it
ships is mostly unreadable. For React >= 17 the same component stack is
already attached via `error.cause` (which does get sourcemaps); for
React < 17 it offers little value either.
Drop the `setContext('react', ...)` call. The surrounding `withScope`
wrapper has no other mutation, so collapse it to a direct
`captureException` call and drop the now-unused `withScope` import.
Sync the spy assertions in `errorboundary.test.tsx`: remove the
`scopeSetContextSpy` setup and rewrite the `cause.stack`-versus-mock
expectations to `expect.any(String)` — the strongest invariant we can
still observe once the spy is gone, since the underlying `setCause` /
`errorBoundaryError.stack = componentStack` chain is unchanged. The
negation case in the recursive-cause test collapses into the existing
`cause.name` assertion, with an inline comment explaining why the
original (non-ErrorBoundary) cause is preserved when the chain loops.
Closes #20094
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>react.componentStack event context1 parent ed0c4cf commit 89d1a79
2 files changed
Lines changed: 8 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 67 | + | |
71 | 68 | | |
72 | 69 | | |
73 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
388 | 387 | | |
389 | 388 | | |
390 | 389 | | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | 390 | | |
395 | 391 | | |
396 | 392 | | |
397 | 393 | | |
398 | 394 | | |
399 | 395 | | |
400 | | - | |
| 396 | + | |
401 | 397 | | |
402 | 398 | | |
403 | 399 | | |
| |||
447 | 443 | | |
448 | 444 | | |
449 | 445 | | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | 446 | | |
454 | 447 | | |
455 | 448 | | |
| |||
486 | 479 | | |
487 | 480 | | |
488 | 481 | | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | 482 | | |
493 | 483 | | |
494 | 484 | | |
495 | 485 | | |
496 | 486 | | |
497 | 487 | | |
498 | | - | |
| 488 | + | |
499 | 489 | | |
500 | 490 | | |
501 | 491 | | |
| |||
530 | 520 | | |
531 | 521 | | |
532 | 522 | | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | 523 | | |
537 | 524 | | |
538 | 525 | | |
539 | 526 | | |
540 | | - | |
541 | | - | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
542 | 531 | | |
543 | 532 | | |
544 | 533 | | |
| |||
698 | 687 | | |
699 | 688 | | |
700 | 689 | | |
701 | | - | |
702 | | - | |
703 | 690 | | |
704 | 691 | | |
705 | 692 | | |
| |||
0 commit comments