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

update next react and react-dom canary versions #67

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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: 6 additions & 4 deletions app/(interview)/interview/[interviewId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { getInterviewById } from '~/server/queries/interviews';
import InterviewShell from '~/components/interview/ui/InterviewShell';

export default async function Page({
params: { interviewId },
params,
searchParams,
}: {
params: { interviewId: string };
searchParams: Record<string, string | string[] | undefined>;
params: Promise<{ interviewId: string }>;
searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
const stage = parseInt(searchParams.stage as string, 10) || 0;
const paramsResult = await searchParams;
const stage = parseInt(paramsResult.stage as string, 10) || 0;
const { interviewId } = await params;

const interviewData = await getInterviewById({ interviewId });
if (!interviewData) {
Expand Down
11 changes: 6 additions & 5 deletions app/(main)/(dashboard)/[study]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import Link from '~/components/Link';
import { route } from 'nextjs-routes';

export default function DashboardLayout({
export default async function DashboardLayout({
children,
params,
}: {
children: React.ReactNode;
params: {
params: Promise<{
study: string;
};
}>;
}) {
const { study } = await params;
return (
<>
<div className="block border-t border-opacity-20 py-5">
Expand All @@ -26,15 +27,15 @@ export default function DashboardLayout({
<Link
href={route({
pathname: '/[study]',
query: { study: params.study },
query: { study },
})}
>
Dashboard
</Link>
<Link
href={route({
pathname: '/[study]/settings',
query: { study: params.study },
query: { study },
})}
>
Settings
Expand Down
8 changes: 4 additions & 4 deletions app/(main)/(dashboard)/[study]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { getStudyData } from '~/server/queries/studies';
export default async function StudyPage({
params,
}: {
params: {
params: Promise<{
study: string;
};
}>;
}) {
const t = await getTranslations('Pages.Study');
const serverPath = getCurrentPath();
const { study } = params;
const serverPath = await getCurrentPath();
const { study } = await params;
const studyData = await getStudyData(study);

if (!studyData) {
Expand Down
4 changes: 1 addition & 3 deletions components/interview/interfaces/name-generator/NodePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { MotionSurface } from '~/components/layout/Surface';
import Heading from '~/components/typography/Heading';
import { cn } from '~/lib/utils';

// incompatibility between framer-motion 12.x and new react types
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const MotionTrigger = motion(Accordion.Trigger);
const MotionTrigger = motion.create(Accordion.Trigger);

export default function Panel({
id,
Expand Down
2 changes: 1 addition & 1 deletion components/interview/ui/InterviewShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default async function InterviewShell({
});
const progress = ((currentStage / stageCount) * 100) as IntRange<0, 100>;

const currentPath = getCurrentPath();
const currentPath = await getCurrentPath();
const interviewId = getInterviewId(currentPath);
const availableLocales = await getAvailableLocales('INTERVIEW', interviewId);
return (
Expand Down
16 changes: 4 additions & 12 deletions lib/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ declare module 'lucia' {
}
}

// interface DatabaseSessionAttributes {}
interface DatabaseUserAttributes {
username: string;
hashedPassword: string;
}

export const getServerSession = cache(async () => {
const sessionId = cookies().get(lucia.sessionCookieName)?.value ?? null;
const c = await cookies();
const sessionId = c.get(lucia.sessionCookieName)?.value ?? null;
if (!sessionId)
return {
session: null,
Expand All @@ -48,19 +48,11 @@ export const getServerSession = cache(async () => {
try {
if (result.session?.fresh) {
const sessionCookie = lucia.createSessionCookie(result.session.id);
cookies().set(
sessionCookie.name,
sessionCookie.value,
sessionCookie.attributes,
);
c.set(sessionCookie.name, sessionCookie.value, sessionCookie.attributes);
}
if (!result.session) {
const sessionCookie = lucia.createBlankSessionCookie();
cookies().set(
sessionCookie.name,
sessionCookie.value,
sessionCookie.attributes,
);
c.set(sessionCookie.name, sessionCookie.value, sessionCookie.attributes);
}
} catch {
// Next.js throws error when attempting to set cookies when rendering page
Expand Down
13 changes: 8 additions & 5 deletions lib/localisation/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ async function getProtocolLocales(interviewId: string): Promise<Locale[]> {
* interview.
*/
export async function getUserLocale(context: LocaleCookieName) {
return (cookies().get(LOCALE_COOKIES[context])?.value as Locale) ?? undefined;
const c = await cookies();
return (c.get(LOCALE_COOKIES[context])?.value as Locale) ?? undefined;
}

/**
Expand All @@ -67,9 +68,10 @@ export async function getAvailableLocales(
}

export async function getBestLocale(availableLocales: Locale[]) {
const h = await headers();
const userAcceptedLocales = new Negotiator({
headers: {
'accept-language': headers().get('accept-language') ?? undefined,
'accept-language': h.get('accept-language') ?? undefined,
},
}).languages();

Expand Down Expand Up @@ -105,7 +107,7 @@ export async function getLocaleMessages(
// For protocol contexts we have to get the messages from the protocol, and
// merge with the main messages for the locale (if available) or the best
// match of the main locale translations if not.
const currentPath = getCurrentPath();
const currentPath = await getCurrentPath();
const interviewId = getInterviewId(currentPath)!;

const protocolMessages = (await fetchProtocolMessages(
Expand All @@ -129,7 +131,8 @@ export async function getLocaleMessages(
}

export async function setUserLocale(locale: Locale) {
const currentPath = getCurrentPath();
const currentPath = await getCurrentPath();
const context = getLocaleContext(currentPath);
cookies().set(LOCALE_COOKIES[context], locale);
const c = await cookies();
c.set(LOCALE_COOKIES[context], locale);
}
2 changes: 1 addition & 1 deletion lib/localisation/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getLocaleContext, getMessageFallback } from './utils';
import { getCurrentPath, getInterviewId } from '../serverUtils';

export default getRequestConfig(async () => {
const currentPath = getCurrentPath();
const currentPath = await getCurrentPath();
const localeContext = getLocaleContext(currentPath);

const interviewId = getInterviewId(currentPath);
Expand Down
5 changes: 3 additions & 2 deletions lib/serverUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import { headers } from 'next/headers';

export function getCurrentPath(): string {
const path = headers().get('x-current-path');
export async function getCurrentPath(): Promise<string> {
const h = await headers();
const path = h.get('x-current-path');

if (!path) {
throw new Error('No x-current-path found in headers');
Expand Down
88 changes: 46 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,50 +18,50 @@
"build-storybook": "storybook build"
},
"dependencies": {
"@formatjs/intl-localematcher": "^0.5.4",
"@formatjs/intl-localematcher": "^0.5.6",
"@lucia-auth/adapter-prisma": "^4.0.1",
"@node-rs/argon2": "^1.8.3",
"@radix-ui/react-accordion": "^1.2.1",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-direction": "^1.1.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-popper": "^1.2.0",
"@radix-ui/react-radio-group": "^1.2.0",
"@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-radio-group": "^1.2.1",
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.2",
"@radix-ui/react-switch": "^1.1.1",
"@radix-ui/react-tooltip": "^1.1.3",
"@t3-oss/env-nextjs": "^0.11.1",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/container-queries": "^0.1.1",
"@types/rtl-detect": "^1.0.3",
"@types/validator": "^13.12.1",
"@types/validator": "^13.12.2",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@upstash/ratelimit": "^2.0.3",
"@vercel/analytics": "^1.3.1",
"@upstash/ratelimit": "^2.0.4",
"@vercel/analytics": "^1.3.2",
"@vercel/kv": "^2.0.0",
"clsx": "^2.1.1",
"eslint-config-prettier": "^9.1.0",
"framer-motion": "12.0.0-alpha.1",
"knip": "^5.30.2",
"lucia": "^3.2.0",
"knip": "^5.34.2",
"lucia": "^3.2.2",
"lucide-react": "^0.394.0",
"nanoid": "^5.0.7",
"negotiator": "^0.6.3",
"next": "15.0.0-canary.160",
"next-intl": "^3.19.1",
"nanoid": "^5.0.8",
"negotiator": "^0.6.4",
"next": "15.0.2",
"next-intl": "^3.23.5",
"next-themes": "^0.3.0",
"nextjs-routes": "2.2.2-rc.4",
"ohash": "^1.1.4",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.6",
"react": "19.0.0-rc-e740d4b1-20240919",
"react-dom": "19.0.0-rc-e740d4b1-20240919",
"prettier-plugin-tailwindcss": "^0.6.8",
"react": "19.0.0-rc-02c0e824-20241028",
"react-dom": "19.0.0-rc-02c0e824-20241028",
"rtl-detect": "^1.1.2",
"sharp": "^0.33.5",
"tailwind-merge": "^2.5.2",
"tailwind-merge": "^2.5.4",
"tailwind-variants": "^0.2.1",
"type-fest": "^4.26.1",
"validator": "^13.12.0",
Expand All @@ -70,33 +70,33 @@
"zustand": "5.0.0-rc.2"
},
"devDependencies": {
"@prisma/client": "^5.19.1",
"@storybook/addon-a11y": "^8.3.0",
"@storybook/addon-essentials": "^8.3.0",
"@storybook/addon-interactions": "^8.3.0",
"@storybook/addon-links": "^8.3.0",
"@storybook/addon-themes": "^8.3.0",
"@storybook/addon-viewport": "^8.3.0",
"@storybook/blocks": "^8.3.0",
"@storybook/nextjs": "^8.3.0",
"@storybook/react": "^8.3.0",
"@storybook/test": "^8.3.0",
"@prisma/client": "^5.21.1",
"@storybook/addon-a11y": "^8.3.6",
"@storybook/addon-essentials": "^8.3.6",
"@storybook/addon-interactions": "^8.3.6",
"@storybook/addon-links": "^8.3.6",
"@storybook/addon-themes": "^8.3.6",
"@storybook/addon-viewport": "^8.3.6",
"@storybook/blocks": "^8.3.6",
"@storybook/nextjs": "^8.3.6",
"@storybook/react": "^8.3.6",
"@storybook/test": "^8.3.6",
"@total-typescript/ts-reset": "^0.5.1",
"@types/negotiator": "^0.6.3",
"@types/node": "^20.16.5",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@types/node": "^20.17.2",
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected]",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.0",
"eslint-config-next": "15.0.0-canary.160",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint": "^8.57.1",
"eslint-config-next": "15.0.2",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-storybook": "^0.8.0",
"postcss": "8.4.38",
"prisma": "^5.19.1",
"storybook": "^8.3.0",
"tailwindcss": "^3.4.11",
"tsx": "^4.19.1",
"typescript": "^5.6.2"
"prisma": "^5.21.1",
"storybook": "^8.3.6",
"tailwindcss": "^3.4.14",
"tsx": "^4.19.2",
"typescript": "^5.6.3"
},
"prisma": {
"schema": "lib/db/schema.prisma",
Expand All @@ -105,6 +105,10 @@
"pnpm": {
"patchedDependencies": {
"@radix-ui/[email protected]": "patches/@[email protected]"
},
"overrides": {
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected]"
}
}
}
Loading