Commit 0c51321
committed
fix: cancel streaming generation before clearing chat
Prevent race condition where _messages.clear() invalidates the
assistantIndex while the generation stream is still yielding tokens.
This could cause RangeError if user taps "Clear Chat" during streaming.
Now _clearChat() cancels the subscription and stops generation before
clearing the message list.1 parent e4202ec commit 0c51321
1 file changed
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
148 | 151 | | |
149 | 152 | | |
150 | 153 | | |
| |||
0 commit comments