wip fix flush
This commit is contained in:
parent
40539d762b
commit
605757f7ee
|
|
@ -121,11 +121,13 @@ export const SyncActions = {
|
|||
}
|
||||
) => ({}) as boolean | ParsedScope | string,
|
||||
action: async (
|
||||
arg: { site_id: string } & (
|
||||
| { type: "startup-check" }
|
||||
| { type: "startup-run" }
|
||||
| { type: "startup-stop" }
|
||||
)
|
||||
arg:
|
||||
| ({ site_id: string } & (
|
||||
| { type: "startup-check" }
|
||||
| { type: "startup-run" }
|
||||
| { type: "startup-stop" }
|
||||
))
|
||||
| { type: "flush-page-cache"; page_id: string }
|
||||
) =>
|
||||
({}) as
|
||||
| undefined
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import { waitUntil } from "web-utils";
|
|||
import { SAction } from "../actions";
|
||||
import { code } from "../editor/code/util-code";
|
||||
import { SyncConnection } from "../type";
|
||||
import { snapshot } from "../entity/snapshot";
|
||||
import { docs } from "../entity/docs";
|
||||
|
||||
const code_startup = {
|
||||
process: {} as Record<string, ExecaChildProcess>,
|
||||
|
|
@ -55,5 +57,14 @@ export const code_action: SAction["code"]["action"] = async function (
|
|||
}
|
||||
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("childs")
|
||||
?.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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue