Commit 86cca01
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 86cca01
1 file changed
Lines changed: 21 additions & 2 deletions
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
126 | 130 | | |
127 | 131 | | |
128 | 132 | | |
129 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
130 | 145 | | |
131 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
132 | 151 | | |
133 | 152 | | |
134 | 153 | | |
| |||
0 commit comments