handle incorrect world in meta

This commit is contained in:
41666 2023-05-22 11:32:45 -04:00
parent 0dcc2450a2
commit ae45b29e93

View file

@ -1,13 +1,8 @@
import type { LoaderArgs, V2_MetaFunction } from "@remix-run/cloudflare"; import type { LoaderArgs, V2_MetaFunction } from "@remix-run/cloudflare";
import { json } from "@remix-run/cloudflare"; import { json } from "@remix-run/cloudflare";
import { useLoaderData } from "@remix-run/react"; import { useLoaderData } from "@remix-run/react";
import { import type { WorldResponse, Zone } from "~/utils/saerro";
WorldResponse, import { allClasses, allVehicles, worldQuery } from "~/utils/saerro";
Zone,
allClasses,
allVehicles,
worldQuery,
} from "~/utils/saerro";
import { pascalCaseToTitleCase, toTitleCase } from "~/utils/strings"; import { pascalCaseToTitleCase, toTitleCase } from "~/utils/strings";
export const loader = async ({ params }: LoaderArgs) => { export const loader = async ({ params }: LoaderArgs) => {
@ -15,7 +10,7 @@ export const loader = async ({ params }: LoaderArgs) => {
}; };
export const meta: V2_MetaFunction<typeof loader> = ({ data }) => { export const meta: V2_MetaFunction<typeof loader> = ({ data }) => {
return [{ title: `${data.world.name} | PS2.LIVE` }]; return [{ title: `${data?.world.name || "Unknown world"} | PS2.LIVE` }];
}; };
export default function World() { export default function World() {