wip fix flush
This commit is contained in:
parent
40539d762b
commit
605757f7ee
|
|
@ -121,11 +121,13 @@ export const SyncActions = {
|
||||||
}
|
}
|
||||||
) => ({}) as boolean | ParsedScope | string,
|
) => ({}) as boolean | ParsedScope | string,
|
||||||
action: async (
|
action: async (
|
||||||
arg: { site_id: string } & (
|
arg:
|
||||||
| { type: "startup-check" }
|
| ({ site_id: string } & (
|
||||||
| { type: "startup-run" }
|
| { type: "startup-check" }
|
||||||
| { type: "startup-stop" }
|
| { type: "startup-run" }
|
||||||
)
|
| { type: "startup-stop" }
|
||||||
|
))
|
||||||
|
| { type: "flush-page-cache"; page_id: string }
|
||||||
) =>
|
) =>
|
||||||
({}) as
|
({}) as
|
||||||
| undefined
|
| undefined
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import { waitUntil } from "web-utils";
|
||||||
import { SAction } from "../actions";
|
import { SAction } from "../actions";
|
||||||
import { code } from "../editor/code/util-code";
|
import { code } from "../editor/code/util-code";
|
||||||
import { SyncConnection } from "../type";
|
import { SyncConnection } from "../type";
|
||||||
|
import { snapshot } from "../entity/snapshot";
|
||||||
|
import { docs } from "../entity/docs";
|
||||||
|
|
||||||
const code_startup = {
|
const code_startup = {
|
||||||
process: {} as Record<string, ExecaChildProcess>,
|
process: {} as Record<string, ExecaChildProcess>,
|
||||||
|
|
@ -55,5 +57,14 @@ export const code_action: SAction["code"]["action"] = async function (
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "flush-page-cache": {
|
||||||
|
const { page_id } = arg;
|
||||||
|
snapshot.del("page", page_id);
|
||||||
|
if (docs.page[page_id] && docs.page[page_id].doc) {
|
||||||
|
docs.page[page_id].doc.destroy();
|
||||||
|
}
|
||||||
|
delete docs.page[page_id];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,14 @@ export const reloadPage = async (
|
||||||
.get("root")
|
.get("root")
|
||||||
?.get("childs")
|
?.get("childs")
|
||||||
?.map((e) => e.get("id")) as string[];
|
?.map((e) => e.get("id")) as string[];
|
||||||
|
|
||||||
|
if (!Array.isArray(p.page.entry)) {
|
||||||
|
p.sync.code
|
||||||
|
.action({ type: "flush-page-cache", page_id: page_id })
|
||||||
|
.then(() => {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.page.doc) {
|
if (p.page.doc) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue