From 9576701d8532b9697df62c96d7c8676afd985b2d Mon Sep 17 00:00:00 2001 From: "Andrew G. Dunn" Date: Mon, 2 Mar 2026 11:31:53 -0500 Subject: [PATCH] fix: await micromorph() to prevent race condition with nav event handlers (#2323) micromorph() returns Promise because its internal patch() function is async and uses Promise.all for recursive child patching. Without await, the DOM morph may still be in progress when the nav event fires and downstream handlers attempt to rebuild dynamic content. Fixes #2322 --- quartz/components/scripts/spa.inline.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quartz/components/scripts/spa.inline.ts b/quartz/components/scripts/spa.inline.ts index 2898dc419..465e79315 100644 --- a/quartz/components/scripts/spa.inline.ts +++ b/quartz/components/scripts/spa.inline.ts @@ -102,7 +102,7 @@ async function _navigate(url: URL, isBack: boolean = false) { html.body.appendChild(announcer) // morph body - micromorph(document.body, html.body) + await micromorph(document.body, html.body) // scroll into place and add history if (!isBack) {