fix
This commit is contained in:
parent
dfd36914c5
commit
188f1905f8
|
|
@ -166,7 +166,9 @@ export const _ = {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return new Response("");
|
return new Response("location.reload", {
|
||||||
|
headers: { "content-type": "application/javascript" },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "route": {
|
case "route": {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { g } from "utils/global";
|
||||||
import { SAction } from "../actions";
|
import { SAction } from "../actions";
|
||||||
import { prepareComponentForPage } from "../editor/prep-comp-page";
|
import { prepareComponentForPage } from "../editor/prep-comp-page";
|
||||||
import { prepContentTree } from "../editor/prep-page";
|
import { prepContentTree } from "../editor/prep-page";
|
||||||
|
|
@ -37,9 +38,13 @@ export const page_load: SAction["page"]["load"] = async function (
|
||||||
doc.on("update", async (update: Uint8Array, origin: any) => {
|
doc.on("update", async (update: Uint8Array, origin: any) => {
|
||||||
const bin = Y.encodeStateAsUpdate(doc);
|
const bin = Y.encodeStateAsUpdate(doc);
|
||||||
snapshot.set("page", id, "bin", bin);
|
snapshot.set("page", id, "bin", bin);
|
||||||
|
snap = snapshot.get("page", id);
|
||||||
const sv_local = await gzipAsync(update);
|
const sv_local = await gzipAsync(update);
|
||||||
|
|
||||||
|
if (snap?.name.startsWith("layout:") && snap.id_site && g.route_cache) {
|
||||||
|
delete g.route_cache[snap.id_site];
|
||||||
|
}
|
||||||
|
|
||||||
const client_ids = new Set<string>();
|
const client_ids = new Set<string>();
|
||||||
user.active.findAll({ page_id: id }).forEach((e) => {
|
user.active.findAll({ page_id: id }).forEach((e) => {
|
||||||
client_ids.add(e.client_id);
|
client_ids.add(e.client_id);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export const yjs_sv_local: SAction["yjs"]["sv_local"] = async function (
|
||||||
) {
|
) {
|
||||||
if (!docs[mode][id]) {
|
if (!docs[mode][id]) {
|
||||||
console.log(`sv_local not found`, mode, id);
|
console.log(`sv_local not found`, mode, id);
|
||||||
return;
|
return { diff: "not-found", sv: "not-found" } as any;
|
||||||
}
|
}
|
||||||
const doc = docs[mode][id].doc as Y.Doc;
|
const doc = docs[mode][id].doc as Y.Doc;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,9 @@ export const loadCompSnapshot = async (
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
if (res.sv === res.diff && (res.sv as any) === "not-found")
|
||||||
|
location.reload();
|
||||||
|
|
||||||
const diff_local = Y.encodeStateAsUpdate(
|
const diff_local = Y.encodeStateAsUpdate(
|
||||||
doc as any,
|
doc as any,
|
||||||
decompress(res.sv)
|
decompress(res.sv)
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,9 @@ export const reloadLayout = async (p: PG, layout_id: string, note: string) => {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
if (res.sv === res.diff && (res.sv as any) === "not-found")
|
||||||
|
location.reload();
|
||||||
|
|
||||||
const diff_local = Y.encodeStateAsUpdate(
|
const diff_local = Y.encodeStateAsUpdate(
|
||||||
doc as any,
|
doc as any,
|
||||||
decompress(res.sv)
|
decompress(res.sv)
|
||||||
|
|
@ -195,6 +198,9 @@ export const reloadPage = async (
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
if (res.sv === res.diff && (res.sv as any) === "not-found")
|
||||||
|
location.reload();
|
||||||
|
|
||||||
const diff_local = Y.encodeStateAsUpdate(
|
const diff_local = Y.encodeStateAsUpdate(
|
||||||
doc as any,
|
doc as any,
|
||||||
decompress(res.sv)
|
decompress(res.sv)
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,7 @@ export const ResponsiveToggle = () => {
|
||||||
const render = () => {
|
const render = () => {
|
||||||
const code = p.code["site"]?.doc;
|
const code = p.code["site"]?.doc;
|
||||||
if (code) {
|
if (code) {
|
||||||
const src = code.getMap("map").get("files")?.get("index.js");
|
applyEnv(p);
|
||||||
applyEnv(p, src);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
treeRebuild(p);
|
treeRebuild(p);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue