-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
useQueryState : TypeError: Cannot read properties of null (reading 'toString') #780
Comments
Do you have more info of where the error is thrown from? FYI, you don't need to specify clearOnDefault: true (it's the default value) |
I'm calling useCreateSessionModal from a client component (named client.tsx):
This client component is used in a page.tsx file :
|
The error is caused by the absence of the "create-session" URL parameter on the page that invokes the hook. |
No, it takes care of that for you. When the search param is not present in the URL, the returned state is the default value. Does the error pop up when rendering the component or is it when triggering an event? Are you using the React Compiler by any chance? If all else fails, could you please provide a minimal reproduction? |
The error pops up when the component is rendered. |
I see one case where a null error would occur (see #781), though it's not on a .toString call, could you try this and let me know if it helps please?
|
Thanks for your help François. It solved my problem. Have a nice weekend. |
🎉 This issue has been resolved in version 2.2.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Context
What's your version of
nuqs
?What framework are you using?
Which version of your framework are you using?
Description
I have a hook (useCreateSessionModal) to display a modal depending on the value of "create-session" from useQueryState :
I have the following error :
TypeError: Cannot read properties of null (reading 'toString')
Reproduction
The text was updated successfully, but these errors were encountered: