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

Fix Next.js Pages Router pathname in AppProvider #4657

Merged
merged 3 commits into from
Feb 4, 2025

Conversation

apedroferreira
Copy link
Member

Use pathname in Next.js Pages Router adapter.

Closes #4645 (comment)

@apedroferreira apedroferreira added the bug 🐛 Something doesn't work label Feb 4, 2025
@apedroferreira apedroferreira requested a review from Janpot February 4, 2025 11:09
@apedroferreira apedroferreira self-assigned this Feb 4, 2025
@@ -8,7 +8,7 @@ import type { AppProviderProps, Navigate, Router } from '../AppProvider';
* @ignore - internal component.
*/
export function NextAppProviderPages(props: AppProviderProps) {
const { push, replace, asPath, query } = useRouter();
const { push, replace, pathname, query } = useRouter();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Janpot is this ok or is there a reason why you were using asPath?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why you were using asPath?

only short-sightedness 🙂

@mui-bot
Copy link

mui-bot commented Feb 4, 2025

Netlify deploy preview

https://deploy-preview-4657--mui-toolpad-docs.netlify.app/

Generated by 🚫 dangerJS against f0ee81a

@apedroferreira apedroferreira enabled auto-merge (squash) February 4, 2025 11:20
@apedroferreira apedroferreira merged commit 3a3821f into mui:master Feb 4, 2025
14 checks passed
@apedroferreira apedroferreira deleted the fix-pages-router-pathname branch February 4, 2025 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NextJS Page Router - navigation item is not matching if url has query params
3 participants