From 0ecb91aa08f13f91194a3aee9a27987a396f48d5 Mon Sep 17 00:00:00 2001 From: MarekWo Date: Tue, 31 Mar 2026 09:47:41 +0200 Subject: [PATCH] fix(dm): show 'Attempt 1/...' immediately after sending DM The retry progress element was always created empty. The socket event with the real attempt count could arrive before the DOM was ready, causing it to be lost. Now pending messages pre-populate with 'Attempt 1/...' which gets updated to the real count when the socket event arrives. Co-Authored-By: Claude Opus 4.6 --- app/static/js/dm.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/static/js/dm.js b/app/static/js/dm.js index 765db85..9fc0114 100644 --- a/app/static/js/dm.js +++ b/app/static/js/dm.js @@ -1208,8 +1208,13 @@ function displayMessages(messages) { deliveryMeta = `
${parts.join(', ')}
`; } - // Retry counter placeholder (same line as delivery meta) - const retryInfo = msg.is_own ? `
` : ''; + // Retry counter placeholder — pre-populate for in-progress sends + let retryInfo = ''; + if (msg.is_own) { + const isPending = !msg.status || (msg.status !== 'delivered' && msg.status !== 'failed'); + const initialText = isPending && msg.expected_ack ? 'Attempt 1/...' : ''; + retryInfo = `
${initialText}
`; + } // Resend button for own messages const resendBtn = msg.is_own ? `