Skip to content

Commit 386c5ab

Browse files
committed
Minor page load fixes
1 parent d8797aa commit 386c5ab

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

common/spaces/evented_space_primitives.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export class EventedSpacePrimitives implements SpacePrimitives {
3131
// Avoid race conditions
3232
return newFileList;
3333
}
34-
// console.log("HEREEREEEREEREE");
3534
this.alreadyFetching = true;
3635
const deletedFiles = new Set<string>(Object.keys(this.spaceSnapshot));
3736
for (const meta of newFileList) {

common/spaces/http_space_primitives.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ export class HttpSpacePrimitives implements SpacePrimitives {
151151
if (res.status === 404) {
152152
throw new Error(`Not found`);
153153
}
154+
if (!res.ok) {
155+
throw new Error(`Failed to get file meta: ${res.statusText}`);
156+
}
154157
return this.responseToMeta(name, res);
155158
}
156159

web/client.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,18 @@ export class Client {
764764
meta: { name: pageName, lastModified: 0, perm: "rw" } as PageMeta,
765765
};
766766
} else {
767-
console.error("Could not load page", pageName, e);
768-
doc = {
769-
text: `**ERROR**: ${e.message}`,
770-
meta: { name: pageName, lastModified: 0, perm: "ro" } as PageMeta,
771-
};
767+
this.flashNotification(
768+
`Could not load page ${pageName}: ${e.message}`,
769+
"error",
770+
);
771+
if (previousPage) {
772+
this.ui.viewDispatch({
773+
type: "page-loading",
774+
name: previousPage,
775+
});
776+
}
777+
778+
return false;
772779
}
773780
}
774781

web/editor_ui.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
import type { Client } from "./client.ts";
2020
import { Panel } from "./components/panel.tsx";
2121
import { h } from "./deps.ts";
22-
import { async } from "https://cdn.skypack.dev/-/regenerator-runtime@v0.13.9-4Dxus9nU31cBsHxnWq2H/dist=es2020,mode=imports/optimized/regenerator-runtime.js";
2322
import { sleep } from "$sb/lib/async.ts";
2423

2524
export class MainUI {

0 commit comments

Comments
 (0)