Skip to content

Commit

Permalink
upgrade nextjs 15 / react 19
Browse files Browse the repository at this point in the history
  • Loading branch information
ipapandinas committed Dec 29, 2024
1 parent 81ef54e commit 1031863
Show file tree
Hide file tree
Showing 9 changed files with 1,972 additions and 1,245 deletions.
6 changes: 2 additions & 4 deletions app/api/revalidate/[tag]/route.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { NextRequest, NextResponse } from "next/server";
import { revalidateTag } from "next/cache";

export async function POST(
_: NextRequest,
{ params }: { params: { tag: string } },
) {
export async function POST(_: NextRequest, props: { params: Promise<{ tag: string }> }) {
const params = await props.params;
const tag = params.tag;
revalidateTag(tag);

Expand Down
19 changes: 12 additions & 7 deletions app/explore/[slug]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ import { FiltersProvider } from "@/contexts/filters";
import { decodingSlug } from "@/utils/url";
import { getFilterOptions } from "@/lib/filters";

export default async function ExploreLayout({
children,
params,
}: {
children: React.ReactNode;
params: { slug: string };
}) {
export default async function ExploreLayout(
props: {
children: React.ReactNode;
params: Promise<{ slug: string }>;
}
) {
const params = await props.params;

const {
children
} = props;

const filterOptions = await getFilterOptions();
const decodedSlug = decodeURIComponent(params.slug);
const filters = decodingSlug(decodedSlug, filterOptions);
Expand Down
8 changes: 5 additions & 3 deletions app/explore/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { decodingSlug } from "@/utils/url";
import { fetchIssues } from "@/lib/api/issues";

interface IProps {
params: { slug: string };
params: Promise<{ slug: string }>;
}

export async function generateMetadata({ params }: IProps): Promise<Metadata> {
export async function generateMetadata(props: IProps): Promise<Metadata> {
const params = await props.params;
const { slug } = params;
const title = slug
.split("-")
Expand All @@ -24,7 +25,8 @@ export async function generateMetadata({ params }: IProps): Promise<Metadata> {
};
}

export default async function ExplorePage({ params }: IProps) {
export default async function ExplorePage(props: IProps) {
const params = await props.params;
const filterOptions = await getFilterOptions();
const decodedSlug = decodeURIComponent(params.slug);
const filters = decodingSlug(decodedSlug, filterOptions);
Expand Down
5 changes: 3 additions & 2 deletions app/projects/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ const SELECT_FILTERS: SelectFilterConfig[] = [
];

interface IProps {
params: { slug: string };
params: Promise<{ slug: string }>;
}

export default async function SingleProjectPage({ params }: IProps) {
export default async function SingleProjectPage(props: IProps) {
const params = await props.params;
const { slug } = params;
const infos = await fetchProjectInfo(slug);

Expand Down
1 change: 1 addition & 0 deletions components/filters/config.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { JSX } from "react";
import { KudosCertifiedIcon } from "@/assets/icons";
import {
TECHNOLOGY_KEY,
Expand Down
2 changes: 1 addition & 1 deletion hooks/useSticky.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState, useEffect, RefObject } from "react";
import { useMediaQuery } from "react-responsive";
import { debounce, throttle } from "@/utils/misc";

const useSticky = (ref: RefObject<HTMLElement>) => {
const useSticky = (ref: RefObject<HTMLElement | null>) => {
const [isSticky, setIsSticky] = useState(false);
const isMobile = useMediaQuery({ maxWidth: 639 }); // tailwind lg default: 640px

Expand Down
1 change: 0 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const nextConfig = {
],
},
reactStrictMode: true,
swcMinify: true,
async headers() {
return [
{
Expand Down
25 changes: 15 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"depcheck": "npx depcheck --ignores 'sharp,autoprefixer,@types/node'"
},
"dependencies": {
"@next/third-parties": "^14.2.13",
"@next/third-parties": "15.1.3",
"@nextui-org/button": "2.2.8",
"@nextui-org/card": "^2.2.8",
"@nextui-org/checkbox": "^2.3.7",
Expand All @@ -34,26 +34,26 @@
"@nextui-org/tooltip": "^2.2.6",
"@tanstack/react-query": "^5.62.11",
"@tanstack/react-query-devtools": "^5.62.11",
"@types/react": "18.3.8",
"@types/react": "19.0.2",
"@vercel/analytics": "^1.4.1",
"autoprefixer": "^10.4.20",
"clsx": "^2.1.1",
"dayjs": "^1.11.13",
"edge-csrf": "^1.0.11",
"eslint": "8.56.0",
"eslint-config-next": "14.2.3",
"eslint": "9.17.0",
"eslint-config-next": "15.1.3",
"framer-motion": "^11.15.0",
"is-email": "^1.0.2",
"isomorphic-dompurify": "^2.19.0",
"marked": "^14.1.2",
"next": "14.2.13",
"next-themes": "^0.3.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"marked": "^15.0.4",
"next": "15.1.3",
"next-themes": "^0.4.4",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-hook-form": "^7.54.2",
"react-responsive": "^10.0.0",
"sharp": "0.33.5",
"tailwind-variants": "^0.2.1",
"tailwind-variants": "^0.3.0",
"tailwindcss": "3.4.17",
"typescript": "5.7.2"
},
Expand All @@ -63,5 +63,10 @@
"@types/node": "22.10.2",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.4.2"
},
"pnpm": {
"overrides": {
"@types/react": "19.0.2"
}
}
}
Loading

0 comments on commit 1031863

Please sign in to comment.