Commit d9522d5
committed
fix(react): guard processor cast and detach on unmount
Two correctness fixes from PR review:
- Guard the `KrispNoiseFilterProcessor` cast in the returned `processor`
value with the same `name === 'livekit-noise-filter'` check used
inside the effect. The unconditional cast assumed nothing else could
attach a `TrackProcessor` to the track; if anything did, the hook
handed consumers a value typed as a Krisp processor that wasn't one.
- Add an unmount-only effect that detaches the Krisp processor from
the currently-managed track. Empty deps so it doesn't interfere with
the existing toggle-reuse path on shouldEnable / filterOptions / track
changes. Closes the gap where a caller-owned `trackRef` outlives the
hook's component, leaving the track with a Krisp processor attached
that the hook no longer manages.1 parent 63fa161 commit d9522d5
1 file changed
Lines changed: 32 additions & 2 deletions
Lines changed: 32 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
51 | 58 | | |
52 | 59 | | |
53 | 60 | | |
| |||
126 | 133 | | |
127 | 134 | | |
128 | 135 | | |
129 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
130 | 154 | | |
131 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
132 | 162 | | |
133 | 163 | | |
134 | 164 | | |
| |||
0 commit comments