1
0

Minor page load fixes

This commit is contained in:
Zef Hemel 2023-10-05 18:24:12 +02:00
parent d8797aa805
commit 386c5ab916
4 changed files with 15 additions and 7 deletions

View File

@ -31,7 +31,6 @@ export class EventedSpacePrimitives implements SpacePrimitives {
// Avoid race conditions // Avoid race conditions
return newFileList; return newFileList;
} }
// console.log("HEREEREEEREEREE");
this.alreadyFetching = true; this.alreadyFetching = true;
const deletedFiles = new Set<string>(Object.keys(this.spaceSnapshot)); const deletedFiles = new Set<string>(Object.keys(this.spaceSnapshot));
for (const meta of newFileList) { for (const meta of newFileList) {

View File

@ -151,6 +151,9 @@ export class HttpSpacePrimitives implements SpacePrimitives {
if (res.status === 404) { if (res.status === 404) {
throw new Error(`Not found`); throw new Error(`Not found`);
} }
if (!res.ok) {
throw new Error(`Failed to get file meta: ${res.statusText}`);
}
return this.responseToMeta(name, res); return this.responseToMeta(name, res);
} }

View File

@ -764,11 +764,18 @@ export class Client {
meta: { name: pageName, lastModified: 0, perm: "rw" } as PageMeta, meta: { name: pageName, lastModified: 0, perm: "rw" } as PageMeta,
}; };
} else { } else {
console.error("Could not load page", pageName, e); this.flashNotification(
doc = { `Could not load page ${pageName}: ${e.message}`,
text: `**ERROR**: ${e.message}`, "error",
meta: { name: pageName, lastModified: 0, perm: "ro" } as PageMeta, );
}; if (previousPage) {
this.ui.viewDispatch({
type: "page-loading",
name: previousPage,
});
}
return false;
} }
} }

View File

@ -19,7 +19,6 @@ import {
import type { Client } from "./client.ts"; import type { Client } from "./client.ts";
import { Panel } from "./components/panel.tsx"; import { Panel } from "./components/panel.tsx";
import { h } from "./deps.ts"; import { h } from "./deps.ts";
import { async } from "https://cdn.skypack.dev/-/regenerator-runtime@v0.13.9-4Dxus9nU31cBsHxnWq2H/dist=es2020,mode=imports/optimized/regenerator-runtime.js";
import { sleep } from "$sb/lib/async.ts"; import { sleep } from "$sb/lib/async.ts";
export class MainUI { export class MainUI {