Fix: add debounce to renderTasks to prevent frontend freeze during WebSocket updates
This commit is contained in:
parent
932dc71b8a
commit
2eee05a52f
@ -7,6 +7,7 @@ class TranscriptionApp {
|
||||
this.ws = null;
|
||||
this.tasks = new Map();
|
||||
this.currentFile = null;
|
||||
this.renderTimeout = null;
|
||||
this.init();
|
||||
}
|
||||
|
||||
@ -170,6 +171,8 @@ class TranscriptionApp {
|
||||
}
|
||||
|
||||
renderTasks() {
|
||||
if (this.renderTimeout) clearTimeout(this.renderTimeout);
|
||||
this.renderTimeout = setTimeout(() => {
|
||||
const container = document.getElementById('tasksList');
|
||||
const tasks = Array.from(this.tasks.values());
|
||||
|
||||
@ -179,6 +182,7 @@ class TranscriptionApp {
|
||||
}
|
||||
|
||||
container.innerHTML = tasks.map(task => this.renderTaskItem(task)).join('');
|
||||
}, 100);
|
||||
}
|
||||
|
||||
renderTaskItem(task) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user