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

Can't read the properties something of 'usePageContext()' #53

Closed
sharmapukar217 opened this issue Sep 23, 2022 · 12 comments
Closed

Can't read the properties something of 'usePageContext()' #53

sharmapukar217 opened this issue Sep 23, 2022 · 12 comments

Comments

@sharmapukar217
Copy link
Contributor

Sometimes using rakkasjs hooks like usePageContext and useLocation throws error showing cant read the properties something of null

@sharmapukar217
Copy link
Contributor Author

also sometimes i get random error showing TypeError: Invalid URL

@sharmapukar217
Copy link
Contributor Author

TypeError: Cannot read properties of null (reading 'useLocation')
This was what I got

@cyco130
Copy link
Member

cyco130 commented Sep 23, 2022

It's because of this bug: vitejs/vite#3301 It probably kicks in when editing the entry-client file. Vite has some problems when doing HMR with React context. I'll see what I can do but it's a long standing issue :/

@sharmapukar217
Copy link
Contributor Author

hey, I think this one was solved by the beta update of vite-plugin-react
https://github.com/vitejs/vite/blob/plugin-react@2.2.0-beta.0/packages/plugin-react/CHANGELOG.md

@cyco130
Copy link
Member

cyco130 commented Oct 19, 2022

hey, I think this one was solved by the beta update of vite-plugin-react https://github.com/vitejs/vite/blob/plugin-react@2.2.0-beta.0/packages/plugin-react/CHANGELOG.md

Awesome, I'll try it soon. I think Vite 4 is just around the corner anyway. I'll try to coincide Rakkas 0.7 with it.

@sharmapukar217
Copy link
Contributor Author

hey, I think this one was solved by the beta update of vite-plugin-react https://github.com/vitejs/vite/blob/plugin-react@2.2.0-beta.0/packages/plugin-react/CHANGELOG.md

Awesome, I'll try it soon. I think Vite 4 is just around the corner anyway. I'll try to coincide Rakkas 0.7 with it.

very excited to see rakkas v0.7 🥳

@sharmapukar217
Copy link
Contributor Author

this is still not fixed

@cyco130
Copy link
Member

cyco130 commented Mar 21, 2023

You're right. I'll look into it more thoroughly.

@cyco130
Copy link
Member

cyco130 commented Mar 31, 2023

I've been failing to replicate this for sometime. Do you have a repro somewhere? Also, are you on a monorepo setup? I think it might be relevant.

@sharmapukar217
Copy link
Contributor Author

I think it's now fixed. BTW is fast refresh disabled by default on rakkasv7? last time i had to manually enable fast refresh. After enabling fast refresh, i was not getting any context related issues. I'd inform you after using it more. For now closing this issue

@cyco130
Copy link
Member

cyco130 commented Mar 31, 2023

is fast refresh disabled by default on rakkasv7?

Erm, no? That's weird. How did you enable it?

@sharmapukar217
Copy link
Contributor Author

Oh i used react field on rakkas' vite plugin 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants