Commit 6d043f8
fix(http): prevent interceptor signal reads from leaking into calling reactive contexts
When `HttpClient` is called from within an `effect()` or other reactive
context, any signal reads performed inside HTTP interceptors were
inadvertently tracked by that context. This caused the effect to
re-execute whenever those signals changed, regardless of whether the
signal was semantically related to the HTTP call.
The fix wraps the interceptor chain invocation in `untracked()` so that
signal reads inside interceptors — both functional (`withInterceptors`)
and class-based (`withInterceptorsFromDi`) — are invisible to the
calling reactive context. This matches the precedent set by the resource
API, which also wraps its loader in `untracked()` for the same reason.
Fixes #586821 parent ae0ec73 commit 6d043f8Copy full SHA for 6d043f8
2 files changed
+106-6Lines changed: 106 additions & 6 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- packages/common/http
- src
- test
Expand file treeCollapse file tree
Open diff view settings
Collapse file
packages/common/http/src/backend.ts
Copy file name to clipboardExpand all lines: packages/common/http/src/backend.ts+8-6Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
9 | 9 | |
10 | 10 | |
11 | 11 | |
12 | | - |
13 | 12 | |
14 | | - |
15 | 13 | |
16 | 14 | |
| 15 | + |
| 16 | + |
| 17 | + |
17 | 18 | |
18 | 19 | |
19 | 20 | |
| ||
116 | 117 | |
117 | 118 | |
118 | 119 | |
| 120 | + |
119 | 121 | |
120 | 122 | |
121 | | - |
122 | | - |
| 123 | + |
| 124 | + |
123 | 125 | |
124 | 126 | |
125 | | - |
126 | | - |
| 127 | + |
| 128 | + |
127 | 129 | |
128 | 130 | |
129 | 131 | |
|
Collapse file
packages/common/http/test/provider_spec.ts
Copy file name to clipboardExpand all lines: packages/common/http/test/provider_spec.ts+98Lines changed: 98 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
25 | 25 | |
26 | 26 | |
27 | 27 | |
| 28 | + |
28 | 29 | |
29 | 30 | |
30 | 31 | |
| 32 | + |
31 | 33 | |
32 | 34 | |
33 | 35 | |
| 36 | + |
34 | 37 | |
35 | 38 | |
36 | 39 | |
| ||
671 | 674 | |
672 | 675 | |
673 | 676 | |
| 677 | + |
| 678 | + |
| 679 | + |
| 680 | + |
| 681 | + |
| 682 | + |
| 683 | + |
| 684 | + |
| 685 | + |
| 686 | + |
| 687 | + |
| 688 | + |
| 689 | + |
| 690 | + |
| 691 | + |
| 692 | + |
| 693 | + |
| 694 | + |
| 695 | + |
| 696 | + |
| 697 | + |
| 698 | + |
| 699 | + |
| 700 | + |
| 701 | + |
| 702 | + |
| 703 | + |
| 704 | + |
| 705 | + |
| 706 | + |
| 707 | + |
| 708 | + |
| 709 | + |
| 710 | + |
| 711 | + |
| 712 | + |
| 713 | + |
| 714 | + |
| 715 | + |
| 716 | + |
| 717 | + |
| 718 | + |
| 719 | + |
| 720 | + |
| 721 | + |
| 722 | + |
| 723 | + |
| 724 | + |
| 725 | + |
| 726 | + |
| 727 | + |
| 728 | + |
| 729 | + |
| 730 | + |
| 731 | + |
| 732 | + |
| 733 | + |
| 734 | + |
| 735 | + |
| 736 | + |
| 737 | + |
| 738 | + |
| 739 | + |
| 740 | + |
| 741 | + |
| 742 | + |
| 743 | + |
| 744 | + |
| 745 | + |
| 746 | + |
| 747 | + |
| 748 | + |
| 749 | + |
| 750 | + |
| 751 | + |
| 752 | + |
| 753 | + |
| 754 | + |
| 755 | + |
| 756 | + |
| 757 | + |
| 758 | + |
| 759 | + |
| 760 | + |
| 761 | + |
| 762 | + |
| 763 | + |
| 764 | + |
| 765 | + |
| 766 | + |
| 767 | + |
| 768 | + |
| 769 | + |
| 770 | + |
| 771 | + |
0 commit comments