Best
This commit is contained in:
1 parent
2fea308b38
commit
f5fd8e632d
4 files changed
+91
-18
No files matched your search
+4
-4
@@ -257,12 +257,12 @@ async function fragmentFor(path, event) {
|
||||
return res.ok ? res.text() : view.notice(...MISSING_NOTICE);
|
||||
}
|
||||
|
||||
// One handler for both callers. htmx is swapping into a shell that is already
|
||||
// on screen and wants the fragment; a navigation has no shell yet and gets the
|
||||
// fragment composed into one.
|
||||
// One handler for every caller. htmx swapping a link into a shell already on
|
||||
// screen wants the bare fragment; a navigation has no shell yet, and a history
|
||||
// restore is rebuilding one, so both get the fragment composed into a document.
|
||||
async function servePage(path, call) {
|
||||
const fragment = await fragmentFor(path, call.event);
|
||||
if (!call.navigate) return fragment;
|
||||
if (!call.navigate && !call.restore) return fragment;
|
||||
try {
|
||||
return await view.compose(fragment, await getBookmark());
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user