Skip to content

Commit

Permalink
feat: upgrade to next.js 15
Browse files Browse the repository at this point in the history
  • Loading branch information
pradel committed Oct 21, 2024
1 parent a1d4909 commit d543873
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 140 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-apricots-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stackspulse": patch
---

Upgrade to next.js 15.
6 changes: 3 additions & 3 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.16.1",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"lint": "next lint",
Expand All @@ -26,7 +26,7 @@
"date-fns": "4.1.0",
"fathom-client": "3.7.2",
"javascript-time-ago": "2.5.11",
"next": "14.2.15",
"next": "15.0.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"recharts": "2.13.0-alpha.4",
Expand All @@ -43,7 +43,7 @@
"@types/react-dom": "18.3.1",
"autoprefixer": "10.4.20",
"eslint": "8.57.0",
"eslint-config-next": "14.2.15",
"eslint-config-next": "15.0.0",
"eslint-plugin-tailwindcss": "3.17.5",
"postcss": "8.4.47",
"radix-themes-tw": "0.2.3",
Expand Down
8 changes: 5 additions & 3 deletions apps/web/src/app/protocols/[protocol]/contracts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { notFound } from "next/navigation";

export const dynamic = "force-dynamic";

export function generateMetadata({ params }: PageProps): Metadata {
export async function generateMetadata(props: PageProps): Promise<Metadata> {
const params = await props.params;
const protocol = params.protocol;

return {
Expand All @@ -17,10 +18,11 @@ export function generateMetadata({ params }: PageProps): Metadata {
}

interface PageProps {
params: { protocol: string };
params: Promise<{ protocol: string }>;
}

export default async function ProtocolPage({ params }: PageProps) {
export default async function ProtocolPage(props: PageProps) {
const params = await props.params;
const protocol = params.protocol;
if (!isProtocol(protocol)) {
notFound();
Expand Down
22 changes: 13 additions & 9 deletions apps/web/src/app/protocols/[protocol]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import type { Metadata } from "next";
import { notFound } from "next/navigation";

interface PageProps {
params: { protocol: string };
params: Promise<{ protocol: string }>;
}

export function generateMetadata({ params }: PageProps): Metadata {
export async function generateMetadata(props: PageProps): Promise<Metadata> {
const params = await props.params;
const protocol = params.protocol;
if (!isProtocol(protocol)) {
notFound();
Expand All @@ -26,13 +27,16 @@ export function generateMetadata({ params }: PageProps): Metadata {
};
}

export default function ProtocolLayout({
children,
params,
}: Readonly<{
children: React.ReactNode;
params: PageProps["params"];
}>) {
export default async function ProtocolLayout(
props: Readonly<{
children: React.ReactNode;
params: PageProps["params"];
}>,
) {
const params = await props.params;

const { children } = props;

const protocol = params.protocol;
if (!isProtocol(protocol)) {
notFound();
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/app/protocols/[protocol]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import { Suspense } from "react";
export const dynamic = "force-dynamic";

interface PageProps {
params: { protocol: string };
params: Promise<{ protocol: string }>;
}

export default async function ProtocolPage({ params }: PageProps) {
export default async function ProtocolPage(props: PageProps) {
const params = await props.params;
const protocol = params.protocol;
if (!isProtocol(protocol)) {
notFound();
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/app/tokens/[token]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ import { Suspense } from "react";
export const dynamic = "force-dynamic";

interface PageProps {
params: { token: string };
params: Promise<{ token: string }>;
}

export async function generateMetadata({
params,
}: PageProps): Promise<Metadata> {
export async function generateMetadata(props: PageProps): Promise<Metadata> {
const params = await props.params;
const metadata = await tokenMetadataClient.GET(
"/metadata/v1/ft/{principal}",
{
Expand All @@ -41,7 +40,8 @@ export async function generateMetadata({
};
}

export default async function ProtocolPage({ params }: PageProps) {
export default async function ProtocolPage(props: PageProps) {
const params = await props.params;
const metadata = await tokenMetadataClient.GET(
"/metadata/v1/ft/{principal}",
{
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/app/tokens/resolve/[token]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { notFound, redirect } from "next/navigation";
export const dynamic = "force-dynamic";

interface PageProps {
params: { token: string };
params: Promise<{ token: string }>;
}

export default async function ProtocolPage({ params }: PageProps) {
export default async function ProtocolPage(props: PageProps) {
const params = await props.params;
const data: TokensResolveRouteResponse = await fetch(
`${env.NEXT_PUBLIC_API_URL}/api/tokens/resolve?id=${params.token}`,
).then((res) => res.json());
Expand Down
Loading

0 comments on commit d543873

Please sign in to comment.