From 59f60e8a46071cc4ebdcce224c82eca9bce7b23e Mon Sep 17 00:00:00 2001 From: Melvin Carvalho Date: Sun, 3 May 2026 06:52:21 +0200 Subject: [PATCH] Sync losos/html.js cache-validity fix from upstream (#15) linkedobjects/losos#16 added a `container.firstChild` guard to the patch fast-path in `render()`, so a stale cache after the container was wiped externally falls through to a fresh build instead of silently no-op'ing on detached nodes. Mirror the upstream change into the vendored copy at `losos/html.js`. Net diff: 2 lines, +90 bytes. Fixes source-pane going blank after tab-switching in the LOSOS shell. --- losos/html.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/losos/html.js b/losos/html.js index ae2cd1a..829a428 100644 --- a/losos/html.js +++ b/losos/html.js @@ -43,8 +43,8 @@ export function render(container, template) { var prev = cache.get(container) - // Same template shape — patch only the holes - if (prev && prev.strings === template.strings) { + // Same template — patch holes. Skip if cached DOM was wiped (#15). + if (prev && prev.strings === template.strings && container.firstChild) { patch(prev.parts, prev.values, template.values) prev.values = template.values return