Skip to content

Commit

Permalink
fix await params for nextjs 15
Browse files Browse the repository at this point in the history
  • Loading branch information
gokulkrishh committed Dec 8, 2024
1 parent e44fab6 commit c1a7a51
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/api/shared/bookmarks/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function GET(request: NextRequest) {
}

const parsedHash = decodeURIComponent(hash ?? '');
const ip = request.ip ?? '127.0.0.1';
let ip = request.headers.get("x-real-ip") ?? '127.0.0.1' as string;
const { success } = await ratelimit.limit(ip);

if (!success) {
Expand Down
2 changes: 1 addition & 1 deletion app/app/auth/callback/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { type CookieOptions, createServerClient } from '@supabase/ssr';
import { urls } from 'config/urls';

export async function GET(request: Request) {
const cookieStore = cookies();
const cookieStore = await cookies();
const { searchParams } = new URL(request.url);
const code = searchParams.get('code');

Expand Down
15 changes: 8 additions & 7 deletions app/app/tags/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ const title = 'Bookmark it.';
const description =
'Bookmark It. is an open-source bookmark manager to organize, discover and personalize your bookmarking experience';

type MetadataType = {
params: { slug: string };
};
type Props = {
params: Promise<{ slug: string }>
searchParams: Promise<{ [key: string]: string | string[] | undefined }>
}

export async function generateMetadata({ params }: MetadataType) {
const { slug } = params;
export async function generateMetadata({ params }: Props) {
const { slug } = await params;
return {
title: `${title} | Tag: ${decodeURIComponent(slug)}`,
description,
};
}

export default async function Page({ params }: { params: { slug: string } }) {
const { slug } = params;
export default async function Page({ params }: Props) {
const { slug } = await params;
const tagName = decodeURIComponent(slug);
const [bookmarks, tags] = await Promise.all([
await getBookmarksForTag(tagName),
Expand Down
2 changes: 1 addition & 1 deletion components/context/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from 'react';

import { ThemeProvider as NextThemesProvider } from 'next-themes';
import { type ThemeProviderProps } from 'next-themes/dist/types';
import { type ThemeProviderProps } from 'next-themes';

export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
Expand Down
4 changes: 2 additions & 2 deletions components/hooks/useInteraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ export function useIntersectionObserver(
entry: undefined,
}));

const callbackRef = useRef<ObserverCallback>();
const callbackRef = useRef<ObserverCallback | null>(null);

callbackRef.current = options?.onChange;
callbackRef.current = options?.onChange ?? null;

const frozen = state.entry?.isIntersecting && freezeOnceVisible;

Expand Down

0 comments on commit c1a7a51

Please sign in to comment.