mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-07 08:27:05 +00:00
perf: use rAF to debounce getContents() during streaming
This commit is contained in:
parent
5645d5bccc
commit
6863ca482c
1 changed files with 6 additions and 1 deletions
|
|
@ -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 () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue