mute-gold
mute-gold•2y ago

TypeError Cannot read properties of undefined (reading 'pathname')

I have create a new project using a superplate cmd and it was working fine until I added my custom dashboard page. Whenever I add a dashboard page in reine component in app.tsx I get an error of TypeError: Cannot read properties of undefined (reading 'pathname') and when I remove the dashboard page it works fine. After digging for a while I figured out that the error is caused by the custom sider components that is present on layout generated by superplaate cmd. What is the issue here exactly can someone help me fix this. I have replicated the same issue in stackblitz and the link is here https://stackblitz.com/edit/refinedev-refine-m2u1fh?file=src/App.tsx
Refine Antd Example (forked) - StackBlitz
Run official live example code for Refine Antd, created by Refinedev on StackBlitz
4 Replies
helpful-purple
helpful-purple•2y ago
Hey @dipbazz sorry for the issue, checking it now Looks like we've missed a line to update in the superplate template, at src/layout/sider/index.tsx Line 112; href="/" should be "to="/" Deploying a fix on superplate now
mute-gold
mute-gold•2y ago
Oh! then if I update my Link from href to be to then it should work right? Thanks for your response.
helpful-purple
helpful-purple•2y ago
Yes it should work, a small mistake on our side 🤦React Router v6 supports to instead of href and while we're replacing the props between templates, forgot that one
mute-gold
mute-gold•2y ago
Okay. It did work. Anyway thank you for your help.