Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 show not found when deployed #120

Merged
merged 1 commit into from
Oct 30, 2024
Merged
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
10 changes: 10 additions & 0 deletions e2e/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ test("has title", async ({ page }) => {
await expect(page).toHaveTitle(/React Starter/);
});

test("not found", async ({ page }) => {
await page.goto("/lost");

await expect(page).toHaveTitle(/React Starter/);

await expect(
page.getByRole("heading", { name: "Error", level: 1 }),
).toBeInViewport();
});

test.describe("external links", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/");
Expand Down
4 changes: 2 additions & 2 deletions src/pages/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export const Error = ({ error }: ErrorComponentProps) => {
<div className="dsy-hero">
<div className="dsy-hero-content text-center">
<div className="max-w-md">
<h1 className="mb-5 text-5xl font-bold opacity-10 lg:text-7xl xl:text-9xl">
<h1 className="mb-5 text-5xl font-bold lg:text-7xl xl:text-9xl">
Error
</h1>
<p className="mb-5">{error.message}</p>
<p className="mb-5 text-error">{error.message}</p>
<Link className="dsy-btn dsy-btn-outline" to="/">
Go back
</Link>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export const NotFound = () => {
<div className="dsy-hero">
<div className="dsy-hero-content text-center">
<div className="max-w-md">
<h1 className="mb-5 text-5xl font-bold opacity-10 lg:text-7xl xl:text-9xl">
<h1 className="mb-5 text-5xl font-bold lg:text-7xl xl:text-9xl">
Error
</h1>
<p className="mb-5">Not Found</p>
<p className="mb-5 text-error">Not Found</p>
<Link className="dsy-btn dsy-btn-outline" to="/">
Go back
</Link>
Expand Down
4 changes: 3 additions & 1 deletion src/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ const Root = () => {
);
};

export const Route = createRootRouteWithContext()({ component: Root });
export const Route = createRootRouteWithContext()({
component: Root,
});
9 changes: 9 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"rewrites": [
{
"source": "/(.*)",
"destination": "/"
}
]
}
Loading