@loadbare/app 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -231,6 +231,11 @@ class LbHub extends HTMLElement {
|
|
|
231
231
|
this.reportUnknownPage(page);
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
|
+
this.page = page;
|
|
235
|
+
// Insert the page shell before fetching its data, not after: the
|
|
236
|
+
// template is already in the document, so holding it back behind a
|
|
237
|
+
// network round trip only leaves <main> empty for no reason.
|
|
238
|
+
this.main.replaceChildren(template.content.cloneNode(true));
|
|
234
239
|
let data = {};
|
|
235
240
|
try {
|
|
236
241
|
data = await fetchData(`${LB_DATA_ENDPOINT}?page=${encodeURIComponent(page)}`);
|
|
@@ -238,10 +243,6 @@ class LbHub extends HTMLElement {
|
|
|
238
243
|
catch (err) {
|
|
239
244
|
console.error(`lb-hub: failed to load data for '${page}'`, err);
|
|
240
245
|
}
|
|
241
|
-
this.page = page;
|
|
242
|
-
// Insert and hydrate in one synchronous block: the browser does not
|
|
243
|
-
// paint mid-task, so there is no empty flash.
|
|
244
|
-
this.main.replaceChildren(template.content.cloneNode(true));
|
|
245
246
|
applyData(this, data);
|
|
246
247
|
}
|
|
247
248
|
/**
|