fix: [app dir bootstrapping 8] useParamsWithFallback hook and add tests#12041
Merged
emrysal merged 3 commits intocalcom:mainfrom Nov 7, 2023
codemod:fix/useParamsWithFallback
Merged
fix: [app dir bootstrapping 8] useParamsWithFallback hook and add tests#12041emrysal merged 3 commits intocalcom:mainfrom codemod:fix/useParamsWithFallback
useParamsWithFallback hook and add tests#12041emrysal merged 3 commits intocalcom:mainfrom
codemod:fix/useParamsWithFallback
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. |
Contributor
|
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link to collect XP and win prizes! |
Contributor
📦 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
4 tasks
zomars
pushed a commit
that referenced
this pull request
Jan 29, 2024
…ests (#12041) * fix: first solution using RouterContext * fix: second solution by importing router from next/compat/router * fix return type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Error: NextRouter was not mountedis thrown ifuseRouterfromnext/routeris called in App router. SinceuseParamsWithFallbackis meant to be used in both page router and app router, this shouldn't happen.pages/workflows/[workflow].tsxto App router, I created a file atapp/workflows/[workflow]/page.tsxthat imports component from@calcom/features/ee/workflows/pages/workflow. The component at@calcom/features/ee/workflows/pages/workflowusesuseParamsWithFallbackhook, in whichuseRouterfromnext/routeris called.Requirement/Documentation
useParamsreturnsnullin Pages RouterType of change
How should this be tested?
yarn vitest run packages/lib/hooks/useParamsWithFallback.test.ts.useParamsWithFallbackin 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