Skip to content

Commit 1372565

Browse files
fix: clean up typing after pending start settles
Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com>
1 parent bd9a87b commit 1372565

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/channels/typing.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,17 @@ export function createTypingCallbacks(params: CreateTypingCallbacksParams): Typi
154154
void stop().catch((err) => (params.onStopError ?? params.onStartError)(err));
155155
};
156156

157+
const hasPendingStart = () => {
158+
for (const start of pendingStarts) {
159+
if (start.pending) {
160+
return true;
161+
}
162+
}
163+
return false;
164+
};
165+
157166
const fireStop = () => {
158-
if ([...pendingStarts].some((start) => start.pending)) {
167+
if (hasPendingStart()) {
159168
stopRequestedDuringPendingStart = true;
160169
}
161170
closed = true;

0 commit comments

Comments
 (0)