Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions client/src/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,19 @@ const clientCache = clientOnly$(new Map<"config", typeof CONFIG_JSON>());
export async function clientLoader({
serverLoader,
}: Route.ClientLoaderArgs): Promise<ClientLoaderReturn> {
const cached = clientCache?.get("config");
if (cached != null) {
return { config: cached, clientSideFetch: false };
}
const { config, clientSideFetch } = await serverLoader();
//? Load the config.json contents from localhost in development
if (clientSideFetch) {
const cached = clientCache?.get("config");
if (cached != null) {
return { config: cached, clientSideFetch };
}
const configResponse = await fetch("/config.json");
const configData = await configResponse.json();
clientCache?.set("config", configData);
return { config: configData as typeof CONFIG_JSON, clientSideFetch };
}
clientCache?.set("config", config);
return { config, clientSideFetch };
}
clientLoader.hydrate = true as const;
Expand Down
4 changes: 4 additions & 0 deletions client/src/routes/catchall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export async function loader({ request }: Route.LoaderArgs) {
return data(null);
}

export async function clientLoader() {
return null;
}

export default function Component() {
return <CatchallApp />;
}
Loading