Skip to content

Commit ffe6c77

Browse files
fix: wall post error handling and speech timer comment
- Check resp.ok on wall post fetch; keep dialog open on failure - Add comment explaining setTimeout(8100) = SPEECH_DURATION_MS + 100ms buffer Addresses feedback from external PR review.
1 parent 1155386 commit ffe6c77

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

ui/js/app.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ function connectSSE() {
148148
};
149149
if (!nearTop) patch.unreadCount = state.unreadCount + 1;
150150
update(patch);
151+
// Re-render after speech bubble expires (SPEECH_DURATION_MS=8000 + 100ms buffer)
151152
setTimeout(scheduleRender, 8100);
152153
if (nearTop && feed) {
153154
requestAnimationFrame(() =>
@@ -325,13 +326,20 @@ const clickActions = [
325326
const msg = input?.value?.trim();
326327
if (!msg) return;
327328
try {
328-
await fetch('/api/wall', {
329+
const resp = await fetch('/api/wall', {
329330
method: 'POST',
330331
headers: { 'Content-Type': 'application/json' },
331332
body: JSON.stringify({ message: msg }),
332333
});
334+
if (!resp.ok) {
335+
console.error('[wall-post] server returned', resp.status);
336+
input?.focus();
337+
return;
338+
}
333339
} catch (e) {
334340
console.error('[wall-post]', e);
341+
input?.focus();
342+
return;
335343
}
336344
update({ showWallPost: false });
337345
state._lastFocusedBeforeDialog?.focus();

0 commit comments

Comments
 (0)