mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-21 13:35:42 -05:00
fix: await micromorph() to prevent race condition with nav event handlers (#2323)
Some checks failed
Build and Test / build-and-test (ubuntu-latest) (push) Has been skipped
Build and Test / publish-tag (push) Has been skipped
Docker build & push image / build (push) Has been skipped
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (push) Has been cancelled
Some checks failed
Build and Test / build-and-test (ubuntu-latest) (push) Has been skipped
Build and Test / publish-tag (push) Has been skipped
Docker build & push image / build (push) Has been skipped
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (push) Has been cancelled
micromorph() returns Promise<void> 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
This commit is contained in:
parent
ec00a40aef
commit
9576701d85
@ -102,7 +102,7 @@ async function _navigate(url: URL, isBack: boolean = false) {
|
|||||||
html.body.appendChild(announcer)
|
html.body.appendChild(announcer)
|
||||||
|
|
||||||
// morph body
|
// morph body
|
||||||
micromorph(document.body, html.body)
|
await micromorph(document.body, html.body)
|
||||||
|
|
||||||
// scroll into place and add history
|
// scroll into place and add history
|
||||||
if (!isBack) {
|
if (!isBack) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user