From 906375dc23a17d3881be7800880b485ac928cbc4 Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Fri, 21 Aug 2026 09:05:21 -0400 Subject: [PATCH] Share the font map with the function that renders it _vvNcStyle referenced a const declared inside vvNcRender, so with the formatting toggle on every mesh transcript threw ReferenceError and drew nothing. The plain-render early return skipped the line, which is why it looked like a slow load rather than a broken one. --- Plugin/unraid/include/node_chat.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Plugin/unraid/include/node_chat.php b/Plugin/unraid/include/node_chat.php index 69489fc..431c6ef 100644 --- a/Plugin/unraid/include/node_chat.php +++ b/Plugin/unraid/include/node_chat.php @@ -413,6 +413,14 @@ function vvNcToggleFmt() { // Style string for a message. Closed set on both ends — the server validates the same values, // so nothing here can emit a property the store did not agree to. +// Module scope, because two functions need it: _vvNcStyle() renders with it and vvNcRender() used +// to declare its own copy. The copy was a `const` inside vvNcRender, so the reference here — in a +// different function — resolved to nothing and threw ReferenceError on every render, but only with +// the formatting toggle on, since the plain-render early return below skips the line that uses it. +// Every mesh transcript therefore failed to draw for anyone who had formatting enabled, and the +// empty catch on the fetch swallowed the reason. +const _VV_NC_FONTS = { mono: 'monospace', sans: 'system-ui,sans-serif', serif: 'Georgia,serif' }; + function _vvNcStyle(m, mine) { // Reader wins over sender. Someone else's purple italic large is their idea of emphasis, and // on a wall-mounted dashboard it is noise — this renders every message plain here without @@ -423,7 +431,7 @@ function _vvNcStyle(m, mine) { const st = m.style || {}; const sizes = { sm: '11px', lg: '14px' }; let s = `color:${st.color || (mine ? '#7a9a7a' : '#9aa')};`; - if (fonts[st.font]) s += `font-family:${fonts[st.font]};`; + if (_VV_NC_FONTS[st.font]) s += `font-family:${_VV_NC_FONTS[st.font]};`; s += `font-size:${sizes[st.size] || '12px'};`; if (st.bold) s += 'font-weight:700;'; if (st.italic) s += 'font-style:italic;'; @@ -528,7 +536,6 @@ function vvNcRender() { + (unreadOnly ? 'Nothing new.' : 'No messages yet — say hello.') + ``; return; } - const fonts = { mono: 'monospace', sans: 'system-ui,sans-serif', serif: 'Georgia,serif' }; box.innerHTML = msgs.map(m => { const mine = m.from === _vvNc.me; const fresh = (m.ts || 0) > _vvNc.lastRead && !mine;