Files
med-notes/.pnpm-store/v10/files/ae/1a82d5ff0c6edf4e8a3b546520b713a4fbf665f61c88904f4d292a2985a5dc858011e942a8b24e5f217732296bc9ce7724eed36bf3b96994846b002a3ed08a
2025-05-09 05:30:08 +02:00

41 lines
1.1 KiB
Plaintext

import { jsx } from "react/jsx-runtime";
import { isNotFound } from "@tanstack/router-core";
import { CatchBoundary } from "./CatchBoundary.js";
import { useRouterState } from "./useRouterState.js";
function CatchNotFound(props) {
const resetKey = useRouterState({
select: (s) => `not-found-${s.location.pathname}-${s.status}`
});
return /* @__PURE__ */ jsx(
CatchBoundary,
{
getResetKey: () => resetKey,
onCatch: (error, errorInfo) => {
var _a;
if (isNotFound(error)) {
(_a = props.onCatch) == null ? void 0 : _a.call(props, error, errorInfo);
} else {
throw error;
}
},
errorComponent: ({ error }) => {
var _a;
if (isNotFound(error)) {
return (_a = props.fallback) == null ? void 0 : _a.call(props, error);
} else {
throw error;
}
},
children: props.children
}
);
}
function DefaultGlobalNotFound() {
return /* @__PURE__ */ jsx("p", { children: "Not Found" });
}
export {
CatchNotFound,
DefaultGlobalNotFound
};
//# sourceMappingURL=not-found.js.map