perf: fast-path length check in StatusHistory comparison (#22103)

Add O(1) array length check before expensive JSON.stringify comparison. During streaming, status history typically only grows via appends, so a length mismatch catches most updates without serialization.
This commit is contained in:
Classic298 authored and GitHub committed 2026-03-01 13:36:42 -05:00
1 parent 391a4878e6
commit 73617ec7fa
1 file changed
+2 -1
@@ -21,7 +21,8 @@
status = history.at(-1);
}
$: if (JSON.stringify(statusHistory) !== JSON.stringify(history)) {
$: if (statusHistory.length !== history.length
|| JSON.stringify(statusHistory) !== JSON.stringify(history)) {
history = statusHistory;
}
</script>