Skip to content

Commit 02a497c

Browse files
Enable typedRoutes and update Next.js
1 parent 12d24b3 commit 02a497c

File tree

6 files changed

+73
-71
lines changed

6 files changed

+73
-71
lines changed

next-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
/// <reference path="./.next/types/routes.d.ts" />
34

45
// NOTE: This file should not be edited
56
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

next.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const __dirname = path.dirname(__filename);
88
/**@type {import('next').NextConfig}*/
99
const config = {
1010
reactStrictMode: true,
11+
typedRoutes: true,
1112
experimental: {
1213
viewTransition: true
1314
},

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
"dotenv-cli": "^10.0.0",
3030
"drizzle-orm": "^0.44.6",
3131
"eslint": "^9.32.0",
32-
"eslint-config-next": "^15.4.5",
32+
"eslint-config-next": "^15.5.4",
3333
"framer-motion": "^12.23.12",
3434
"jotai": "^2.12.5",
3535
"lucide-react": "^0.536.0",
36-
"next": "^15.4.5",
36+
"next": "^15.5.4",
3737
"next-auth": "5.0.0-beta.29",
3838
"next-cloudinary": "^6.16.0",
3939
"next-seo": "^6.8.0",

pnpm-lock.yaml

Lines changed: 62 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/(public)/_components/hero.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ export function Hero() {
3232
function handleSearch(e: React.FormEvent) {
3333
e.preventDefault();
3434
const formData = new FormData(e.target as HTMLFormElement);
35-
let chosenLanguages = selected;
35+
const chosenLanguages = [...selected];
3636

3737
// Fallback: if no checkbox selected, use the single input value
3838
if (chosenLanguages.length === 0) {
3939
const typed = String(formData.get('search') || '').trim();
4040
if (typed) {
41-
chosenLanguages = [typed];
41+
chosenLanguages.push(typed);
4242
}
4343
}
4444

src/app/(public)/_components/search-form.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ export function SearchForm() {
2626
}
2727

2828
function onSubmit({ searchQuery }: FormValues) {
29+
if (!pathname.startsWith('/repos')) return;
30+
31+
const reposPathname = pathname as `/repos/${string}`;
2932
const trimmedQuery = searchQuery.trim();
3033
if (trimmedQuery !== '') {
3134
const sp = new URLSearchParams(searchParams);
3235
sp.set('q', trimmedQuery);
33-
router.push(`${pathname}?${sp.toString()}`);
36+
router.push(`${reposPathname}?${sp.toString()}`);
3437
}
3538
}
3639

3740
return (
3841
<div className="w-full">
39-
<form
40-
className="w-full form-control"
41-
onSubmit={handleSubmit(onSubmit)}
42-
>
42+
<form className="w-full form-control" onSubmit={handleSubmit(onSubmit)}>
4343
<div className="relative">
4444
<input
4545
placeholder="Search"

0 commit comments

Comments
 (0)