Skip to content

Commit bb86d91

Browse files
Algorithm5838github-actions[bot]
authored andcommitted
fix: always rAF-throttle markdown parsing during streaming
1 parent 1774d73 commit bb86d91

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

src/lib/components/chat/Messages/Markdown.svelte

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,11 @@
7474
};
7575
7676
const updateHandler = (content) => {
77-
if (content) {
78-
if (done) {
79-
cancelAnimationFrame(pendingUpdate);
77+
if (content && !pendingUpdate) {
78+
pendingUpdate = requestAnimationFrame(() => {
8079
pendingUpdate = null;
8180
parseTokens();
82-
} else if (!pendingUpdate) {
83-
pendingUpdate = requestAnimationFrame(() => {
84-
pendingUpdate = null;
85-
parseTokens();
86-
});
87-
}
81+
});
8882
}
8983
};
9084

0 commit comments

Comments
 (0)