-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
fix: [app dir bootstrapping 8] useParamsWithFallback
hook and add tests
#12041
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@hbjORbj is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link to collect XP and win prizes! |
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
useParamsWithFallback
hook and add testsuseParamsWithFallback
hook and add tests
66176eb
to
f511ea4
Compare
1400259
to
bdad5e9
Compare
bdad5e9
to
cf5a295
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, lgtm
…ests (#12041) * fix: first solution using RouterContext * fix: second solution by importing router from next/compat/router * fix return type
What does this PR do?
Error: NextRouter was not mounted
is thrown ifuseRouter
fromnext/router
is called in App router. SinceuseParamsWithFallback
is meant to be used in both page router and app router, this shouldn't happen.pages/workflows/[workflow].tsx
to App router, I created a file atapp/workflows/[workflow]/page.tsx
that imports component from@calcom/features/ee/workflows/pages/workflow
. The component at@calcom/features/ee/workflows/pages/workflow
usesuseParamsWithFallback
hook, in whichuseRouter
fromnext/router
is called.Requirement/Documentation
useParams
returnsnull
in Pages RouterType of change
How should this be tested?
yarn vitest run packages/lib/hooks/useParamsWithFallback.test.ts
.useParamsWithFallback
in any client component in app router page. You can go to this branch, create any dummy component in app router and call the hook from there.Mandatory Tasks