aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-11-17 13:14:04 -0700
committerAdam Soltys <[email protected]>2026-11-17 13:14:04 -0700
commita91155b1904384a8b2f151a9c50df06ad068a397 (patch)
tree40973820f2abe60a270dd62ec472c8a87b1855e9 /src/features
parent7b2c4626ae67f9d337d285bdd9170f511a9c14aa (diff)
downloadcoinosv3-a91155b1904384a8b2f151a9c50df06ad068a397.tar.gz
coinosv3-a91155b1904384a8b2f151a9c50df06ad068a397.zip
A draft's Preview shows a link as its card. "i added metadata to paff pages, was hoping links to movies would render with a nicely formatted thumbnail" (Adam, 2026-11-17). The registrar already reads paff.club's movie pages (title "Hackers (1995) · from 1:21:50", description, backdrop), and a posted note warms its links' cards before it shows; the composer's Preview ran the same renderer but never asked for the page, so a link not already cached stayed a bare URL. It now asks once the typing settles (half a second), then repaints into the card. link-preview-test (a draft's preview shows the movie card, asked once) and compose-preview-test pass.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6SwkivduFDDkMmnXjZ
Diffstat (limited to 'src/features')
-rw-r--r--src/features/messages.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 95fcde8..6875856 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -14099,8 +14099,21 @@ export function messagesFeature(ctx) {
// You could only find out by posting. This runs the draft through noteBody
// — the very renderer the feed uses — so the preview is not a lookalike of
// the real thing, it IS the real thing.
+ // A link's card needs its page read first: the feed warms that before a
+ // post shows, a draft only once the typing settles (not one registrar call
+ // per keystroke of a URL), then repaints into the card.
+ let draftPvTimer = null;
+ function warmDraftPreviews(body) {
+ const want = notePreviewUrls(body).filter((u) => !previews.has(u));
+ clearTimeout(draftPvTimer);
+ if (!want.length) return;
+ draftPvTimer = setTimeout(() => {
+ for (const u of want) warmPreview(u).then(() => { if (previews.get(u)) scheduleRepaint(); });
+ }, 500);
+ }
function draftPreview(text) {
const body = String(text || '').trim();
+ warmDraftPreviews(body);
return h('div', { class: 'draft-preview' },
h('div', { class: 'draft-preview-tag' }, t('composePreviewTag')),
body