Skip to main content

max / makenotwork

server: wait on the real condition instead of a guessed delay, four sites Each of the four waited a fixed interval for something it could observe directly, and the intervals differed by a factor of five for the same kind of pause. - dashboard-user's reactivate form guessed 500ms for an in-flight POST. It is data-after="reload" now, which runs on htmx:after:request and already refuses a >=400 response. window.reactivateReload goes with it. - tab-project-settings reloaded 300ms after the response landed, from inside the r.ok branch that had already proven the write. - tab-user-media clicked #tab-media 1000ms after remaining.length === 0, which is itself the settled condition. - item-upload clicked #tab-files 1500ms after the last entry uploaded. Closes mnw-server e7a6056b. The fifth site it recorded, actions-dashboards.js:21, was taken by its screen's conversion.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-08-28 20:00 UTC
Signed with PGP, not checked
Commit: 94a90bac6ffade6acbeefe866daf023d7f568709
Parent: 60448c2
5 files changed, +8 insertions, -13 deletions
@@ -5,11 +5,6 @@
5 5 // element and any data-arg/data-arg2 attributes passed as arguments. Bodies
6 6 // are preserved verbatim from the original inline handlers.
7 7
8 - // Reactivate-account form: schedule a page reload after the HTMX request.
9 - window.reactivateReload = function () {
10 - setTimeout(function(){ window.location.reload(); }, 500);
11 - };
12 -
13 8 // Copy the item id to the clipboard and flash feedback on the button. The
14 9 // revert is core/clipboard.ts's, through the legacy bridge; 1500 is the
15 10 // duration this button already used.
@@ -142,10 +142,8 @@
142 142 if (i >= entries.length) {
143 143 document.getElementById('version-upload-progress').classList.add('hidden');
144 144 document.getElementById('version-upload-success').classList.remove('hidden');
145 - setTimeout(function() {
146 - var filesBtn = document.getElementById('tab-files');
147 - if (filesBtn) filesBtn.click();
148 - }, 1500);
145 + var filesBtn = document.getElementById('tab-files');
146 + if (filesBtn) filesBtn.click();
149 147 return;
150 148 }
151 149
@@ -226,8 +226,9 @@
226 226 }).then(function(r) {
227 227 if (r.ok) {
228 228 if (status) { status.textContent = 'Saved'; status.style.color = 'var(--success)'; }
229 - // Reload the page so the tab bar reflects new features
230 - setTimeout(function() { window.location.reload(); }, 300);
229 + // Reload the page so the tab bar reflects new features. The
230 + // response is in hand in this branch, so there is nothing to wait for.
231 + window.location.reload();
231 232 } else {
232 233 if (status) { status.textContent = 'Save failed'; status.style.color = 'var(--danger)'; }
233 234 }
@@ -105,7 +105,8 @@
105 105 // Refresh tab after last file
106 106 var remaining = progress.querySelectorAll('.user-media-upload-status:not(.user-media-upload-status--ok):not(.user-media-upload-status--err)');
107 107 if (remaining.length === 0) {
108 - setTimeout(function() { document.getElementById('tab-media').click(); }, 1000);
108 + var mediaBtn = document.getElementById('tab-media');
109 + if (mediaBtn) mediaBtn.click();
109 110 }
110 111 });
111 112 })(fileList[i]);
@@ -21,7 +21,7 @@
21 21 <p>You can:</p>
22 22 <div class="account-status-actions">
23 23 <form hx-post="/api/users/me/reactivate" hx-swap="none"
24 - data-submit="reactivateReload">
24 + data-after="reload">
25 25 <button type="submit" class="btn-primary">Reactivate Account</button>
26 26 </form>
27 27 <a href="/dashboard/export" class="button">Export Data</a>