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
router.push event is throwing TypeError: Cannot destructure property 'auth' of 'urlObj' as it is undefined. #65357
Comments
I encountered a similar problem in my project as well. After some messing around, it appears that the issue might be related to NextUI, Because I do have another component library in the project too and that worked fine. I found a workaround for the issue by patching all instances of router.open in the NextUI. Sending additional href in the parameter to the function call, since I noticed the router interface contains interface Router {
isNative: boolean;
open: (target: Element, modifiers: Modifiers, href: Href, routerOptions: RouterOptions | undefined) => void;
useHref: (href: Href) => string;
} It seems to resolve the issue for me I use pnpm to patch all of these occurrence - router.open(e.currentTarget, e);
+ router.open(e.currentTarget, e, e.currentTarget.href);
- router.open(e.target, e);
+ router.open(e.target, e, e.target.href);
- router.open(e.currentTarget, e);
+ router.open(e.currentTarget, e, e.currentTarget.href); Then, finally, don't forget to clear your webpack cache or delete your .next folder This workaround may not be the optimal solution and there's a possibility it could introduce other issues, I haven't looked deep into it, because I need to get my project working in time 😅 EDIT: Seem like there is a PR to fix this now on NextUI repo: nextui-org/nextui#2943 |
@YuzuZensai Thanks for helping me out. |
Link to the code that reproduces this issue
https://github.com/vizsumit/next-js-bug
To Reproduce
Current vs. Expected behavior
after clicking link relevant page should open
Provide environment information
Which area(s) are affected? (Select all that apply)
Pages Router
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I am using chip component from nextui lib, which takes router.push as obj to navigate.
The text was updated successfully, but these errors were encountered: