perf: use rAF to debounce getContents() during streaming
This commit is contained in:
@@ -964,7 +964,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$: if (history) {
|
$: if (history) {
|
||||||
getContents();
|
cancelAnimationFrame(contentsRAF);
|
||||||
|
contentsRAF = requestAnimationFrame(() => {
|
||||||
|
getContents();
|
||||||
|
contentsRAF = null;
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
artifactContents.set([]);
|
artifactContents.set([]);
|
||||||
}
|
}
|
||||||
@@ -1294,6 +1298,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
let scrollRAF = null;
|
let scrollRAF = null;
|
||||||
|
let contentsRAF = null;
|
||||||
const scheduleScrollToBottom = () => {
|
const scheduleScrollToBottom = () => {
|
||||||
if (!scrollRAF) {
|
if (!scrollRAF) {
|
||||||
scrollRAF = requestAnimationFrame(async () => {
|
scrollRAF = requestAnimationFrame(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user