-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[🐞]Error: Code(13): Actual value for useContext() can not be found... #6399
Comments
Try changing line 17 to |
Yes, that will work for sure, but I can already work around the issue. The point is that totally valid code causes the runtime to throw an error and quit. The Stackblitz project is the simplest form I could find that would reproduce the problem. It's not representative of the code I'm actually trying to write (something similar to the Portals example in the docs) The bit that's interesting is the code was initially using useComputed:
Which also didn't work, but this did
which is why I tried contriving what's in the Stackblitz code
What's the difference between 2 & 3? Why does having Comp stored in an object propety make a difference? |
qwik only serializes context that is used during SSR. Are you using This is a feature to prevent sending useless context data to the client. If this was the problem, how should the error message have been changed to make this clear to you? |
In newer versions of Qwik, the error message has been improved with the additon of "In the browser make sure that the context was used during SSR so its state was serialized." so that makes it clearer what the issue is. However there are a few remaining concerns:
|
Which component is affected?
Qwik Runtime
Describe the bug
Attempting to show a component client side only - no SSR
The component calls
useLocation
Qwik thows an error:
Error: Code(13): Actual value for useContext() can not be found, make sure some ancestor component has set a value using useContextProvider()
Reproduction
https://stackblitz.com/edit/qwik-starter-wvympk?file=src%2Froutes%2Findex.tsx
Steps to reproduce
npm install && npm run dev
System Info
Additional Information
The error message seems to indicate that this is expected behavior. I would contend that it's pretty bad behavior if that's the case! I had code that was working perfectly until I introduced a new route that did't call useLocation server-side
The text was updated successfully, but these errors were encountered: