Skip to content

Commit fbda26a

Browse files
committed
Fix column map loading
1 parent 35ad012 commit fbda26a

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

pages/+Page.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,9 @@ export function Page() {
8484
h("p", "Macrostrat documentation")
8585
),
8686
h.if(isDev)(
87-
h(
88-
LinkCard,
89-
{ title: "Developer apps", href: "/dev" },
90-
h("p", "Layers and testbed apps that aren't ready for prime time")
91-
)
87+
LinkCard,
88+
{ title: "Developer apps", href: "/dev" },
89+
h("p", "Layers and testbed apps that aren't ready for prime time")
9290
),
9391
]),
9492
Donate,

pages/columns/+Page.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,24 @@ import { PageHeader, Link, AssistantLinks, DevLinkButton } from "~/components";
33
import { Divider, AnchorButton, Card, Icon } from "@blueprintjs/core";
44
import { useState } from "react";
55
import h from "./main.module.scss";
6-
import { onDemand } from "~/_utils";
76
import { useData } from "vike-react/useData";
7+
import { ClientOnly } from "vike-react/ClientOnly";
88

99
export function Page(props) {
1010
return h(ColumnListPage, props);
1111
}
1212

13-
const ColumnsMapContainer = onDemand(() =>
14-
import("./map").then((d) => d.ColumnsMapContainer)
15-
);
13+
function ColumnMapContainer(props) {
14+
return h(
15+
ClientOnly,
16+
{
17+
load: () => import("./map.client").then((d) => d.ColumnsMapContainer),
18+
fallback: h("div.loading", "Loading map..."),
19+
deps: [props.columnIDs, props.projectID],
20+
},
21+
(component) => h(component, props)
22+
);
23+
}
1624

1725
function ColumnListPage({ title = "Columns", linkPrefix = "/" }) {
1826
const { columnGroups, project } = useData();
@@ -57,7 +65,7 @@ function ColumnListPage({ title = "Columns", linkPrefix = "/" }) {
5765
h(AssistantLinks, [
5866
h(AnchorButton, { href: "/projects", minimal: true }, "Projects"),
5967
h(DevLinkButton, { href: "/columns/correlation" }, "Correlation chart"),
60-
h(ColumnsMapContainer, { columnIDs, projectID: project.project_id }),
68+
h(ColumnMapContainer, { columnIDs, projectID: project?.project_id }),
6169
]),
6270
h(ContentPage, [
6371
h(PageHeader, { title }),

0 commit comments

Comments
 (0)