Spaces:
Runtime error
Runtime error
Commit ·
421faaf
1
Parent(s): 9e24aab
Cache DOM elements and add no-op guard in status poller
Browse filesCache #swap-status textarea and .loader-text once before the interval
instead of re-querying the DOM on every 300ms tick. Track lastText to
skip the DOM write when the status text hasn't changed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- static/wire_outputs.js +9 -5
static/wire_outputs.js
CHANGED
|
@@ -362,12 +362,16 @@ function init() {
|
|
| 362 |
|
| 363 |
function startStatusPolling() {
|
| 364 |
stopStatusPolling();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 365 |
_statusPoller = setInterval(() => {
|
| 366 |
-
const
|
| 367 |
-
if (!
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
}, 300);
|
| 372 |
}
|
| 373 |
|
|
|
|
| 362 |
|
| 363 |
function startStatusPolling() {
|
| 364 |
stopStatusPolling();
|
| 365 |
+
const statusEl = document.querySelector('#swap-status textarea');
|
| 366 |
+
const loaderText = document.querySelector('.loader-text');
|
| 367 |
+
if (!statusEl || !loaderText) return;
|
| 368 |
+
let lastText = '';
|
| 369 |
_statusPoller = setInterval(() => {
|
| 370 |
+
const text = statusEl.value.trim();
|
| 371 |
+
if (text && text !== lastText) {
|
| 372 |
+
lastText = text;
|
| 373 |
+
loaderText.textContent = text;
|
| 374 |
+
}
|
| 375 |
}, 300);
|
| 376 |
}
|
| 377 |
|