fix reload

This commit is contained in:
Rizky 2024-01-18 16:04:42 +08:00
parent 3e5a7ea411
commit 7937a1d772
3 changed files with 5 additions and 4 deletions

View File

@ -28,7 +28,7 @@ export const EdBase = () => {
edRoute(p);
if (p.status === "loading") {
if (p.status === "post-init") {
return <Loading note={`page-${p.status}`} />;
}
if (p.status === "site-not-found" || p.status === "page-not-found") {

View File

@ -123,7 +123,8 @@ export const EDGlobal = {
clients: {} as Record<string, { id: string; username: string }>,
status: "init" as
| "init"
| "loading"
| "post-init"
| "reload"
| "site-not-found"
| "page-not-found"
| "ready",

View File

@ -8,7 +8,7 @@ import { treeRebuild } from "./tree/build";
export const edRoute = async (p: PG) => {
if (p.status === "ready" || p.status === "init") {
if (!p.site.domain && !p.site.name) {
p.status = "loading";
p.status = "post-init";
const site = await p.sync.site.load(p.site.id);
if (!site) {
p.status = "site-not-found";
@ -39,7 +39,7 @@ export const edRoute = async (p: PG) => {
};
export const reloadPage = async (p: PG, page_id: string, note: string) => {
p.status = "loading";
p.status = "reload";
const remotePage = await p.sync.page.load(page_id);
if (!remotePage) {