fix reload

This commit is contained in:
Rizky 2024-07-27 14:07:40 +07:00
parent 0532bf3f48
commit 70d650b4c4
3 changed files with 14 additions and 11 deletions

View File

@ -85,8 +85,9 @@ export const loadCompSnapshot = async (
); );
if (res) { if (res) {
if (res.sv === res.diff && (res.sv as any) === "not-found") if (res.sv === res.diff && (res.sv as any) === "not-found") {
location.reload(); //location.reload();();
}
const diff_local = Y.encodeStateAsUpdate( const diff_local = Y.encodeStateAsUpdate(
doc as any, doc as any,

View File

@ -80,8 +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") if (res.sv === res.diff && (res.sv as any) === "not-found") {
location.reload(); //location.reload();();
}
const diff_local = Y.encodeStateAsUpdate( const diff_local = Y.encodeStateAsUpdate(
doc as any, doc as any,
@ -184,7 +185,7 @@ export const reloadPage = async (
if (page.page.id !== remotePage.id) { if (page.page.id !== remotePage.id) {
alert("Page ID Mismatch!\n Refreshing to preventing data loss..."); alert("Page ID Mismatch!\n Refreshing to preventing data loss...");
location.reload(); //location.reload();();
return; return;
} }
if ((window as any).catch) { if ((window as any).catch) {
@ -198,8 +199,9 @@ export const reloadPage = async (
); );
if (res) { if (res) {
if (res.sv === res.diff && (res.sv as any) === "not-found") if (res.sv === res.diff && (res.sv as any) === "not-found") {
location.reload(); //location.reload();();
}
const diff_local = Y.encodeStateAsUpdate( const diff_local = Y.encodeStateAsUpdate(
doc as any, doc as any,
@ -246,7 +248,7 @@ export const reloadPage = async (
p.sync.code p.sync.code
.action({ type: "flush-page-cache", page_id: page_id }) .action({ type: "flush-page-cache", page_id: page_id })
.then(() => { .then(() => {
location.reload(); //location.reload();();
}); });
} }
} }

View File

@ -92,7 +92,7 @@ export const EdApiDB = ({
localStorage.removeItem(`schema-md-${p.site.id}`); localStorage.removeItem(`schema-md-${p.site.id}`);
_api.clear_route_cache(p.site.id); _api.clear_route_cache(p.site.id);
location.reload(); //location.reload();();
}} }}
> >
Generate Generate
@ -114,7 +114,7 @@ export const EdApiDB = ({
localStorage.removeItem(`schema-md-${p.site.id}`); localStorage.removeItem(`schema-md-${p.site.id}`);
_api.clear_route_cache(p.site.id); _api.clear_route_cache(p.site.id);
location.reload(); //location.reload();();
}} }}
> >
DB Pull DB Pull
@ -135,7 +135,7 @@ export const EdApiDB = ({
render(); render();
alert("RESTART: OK"); alert("RESTART: OK");
_api.clear_route_cache(p.site.id); _api.clear_route_cache(p.site.id);
location.reload(); //location.reload();();
}} }}
> >
Restart Server Restart Server