perf: use rAF to debounce getContents() during streaming

This commit is contained in:
Algorithm5838
2026-03-01 23:42:16 +03:00
parent 5645d5bccc
commit 6863ca482c

View File

@@ -964,7 +964,11 @@
};
$: if (history) {
getContents();
cancelAnimationFrame(contentsRAF);
contentsRAF = requestAnimationFrame(() => {
getContents();
contentsRAF = null;
});
} else {
artifactContents.set([]);
}
@@ -1294,6 +1298,7 @@
};
let scrollRAF = null;
let contentsRAF = null;
const scheduleScrollToBottom = () => {
if (!scrollRAF) {
scrollRAF = requestAnimationFrame(async () => {