This commit is contained in:
Rizky 2024-02-16 05:19:56 +07:00
parent a2a73ed6e6
commit 5a745a7b9a
3 changed files with 28 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
import { FC, useState } from "react";
import { GlobalContext } from "web-utils";
import { GlobalContext, useLocal } from "web-utils";
import { DeadEnd } from "../../utils/ui/deadend";
import { Loading } from "../../utils/ui/loading";
import { evalCJS } from "../ed/logic/ed-sync";
@ -13,6 +13,7 @@ import { w } from "./w";
export const Root = () => {
// #region context
const local = useLocal({ page_id: "" });
const [_, set] = useState({});
const render = () => set({});
w.prasiContext.render = render;
@ -55,7 +56,11 @@ export const Root = () => {
const page = router.lookup(base.pathname);
if (!page) return <DeadEnd>Page Not Found</DeadEnd>;
w.params = page.params || {};
if (page.id !== local.page_id) {
base.init_local_effect = {};
}
w.params = page.params || {};
base.page.id = page.id;
base.page.url = page.url;

View File

@ -52,6 +52,7 @@ export const createViLocal = (
}
}
}
let should_run = !init_local_effect[id];
if (should_run) {
if (typeof init_local_effect === "object") {