This commit is contained in:
Rizky 2023-10-17 14:40:57 +07:00
parent 6f6f1cdf53
commit ad2d935f3c
1 changed files with 2 additions and 11 deletions

View File

@ -8,8 +8,6 @@ import { LPage, LiveGlobal, PG } from "./global";
import { liveWS, wsend } from "./ws"; import { liveWS, wsend } from "./ws";
import { rebuildTree } from "./tree-logic"; import { rebuildTree } from "./tree-logic";
const cacheMeta = {} as Record<string, (typeof LiveGlobal)["treeMeta"]>;
export const routeLive = (p: PG, pathname: string) => { export const routeLive = (p: PG, pathname: string) => {
if (p.status !== "loading") { if (p.status !== "loading") {
let page_id = ""; let page_id = "";
@ -34,16 +32,9 @@ export const routeLive = (p: PG, pathname: string) => {
if (page_id) { if (page_id) {
(window as any).prasiPageID = page_id; (window as any).prasiPageID = page_id;
const promises: Promise<void>[] = []; const promises: Promise<void>[] = [];
let hasCache = false;
if (page_id !== p.page?.id) { if (page_id !== p.page?.id) {
if (p.page) {
cacheMeta[p.page.id] = p.treeMeta;
}
p.page = p.pages[page_id]; p.page = p.pages[page_id];
p.treeMeta = {};
console.clear();
console.log("resetting page");
} }
if (!p.page || !p.page.content_tree) { if (!p.page || !p.page.content_tree) {
promises.push(loadNpmPage(p, page_id)); promises.push(loadNpmPage(p, page_id));
@ -66,7 +57,7 @@ export const routeLive = (p: PG, pathname: string) => {
p.render(); p.render();
}); });
} else { } else {
if (p.prod && !hasCache && !firstRender[page_id]) { if (p.prod && !firstRender[page_id]) {
firstRender[page_id] = true; firstRender[page_id] = true;
pageLoaded(p).then(p.render); pageLoaded(p).then(p.render);
} else { } else {