qwik
qwik copied to clipboard
[🐞] Code(13): Actual value for useContext(button-context) can not be found, make sure some ancestor component has set a value using useContextProvider()
Which component is affected?
Qwik Runtime
Describe the bug
I get an error on the client when using the Context API, when I want to update a signal from a child. See the repro to understand.
The error looks like:
Error: Code(13): Actual value for useContext(button-context) can not be found, make sure some ancestor component has set a value using useContextProvider(). In the browser make sure that the context was used during SSR so its state was serialized.
Reproduction
https://stackblitz.com/edit/github-n3deah?file=src%2Froutes%2Findex.tsx
Steps to reproduce
Open the Repro url above: There is 2 examples.
- Open the browser console
- Click on any button
Depend on the example you will get an error that looks like:
Error: Code(13): Actual value for useContext(button-context) can not be found, make sure some ancestor component has set a value using useContextProvider(). In the browser make sure that the context was used during SSR so its state was serialized.
System Info
System:
OS: macOS 14.3
CPU: (8) arm64 Apple M3
Memory: 1.21 GB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.2.0 - /opt/homebrew/bin/node
npm: 10.7.0 - /opt/homebrew/bin/npm
pnpm: 9.7.0 - /opt/homebrew/bin/pnpm
Browsers:
Safari: 17.3
npmPackages:
@builder.io/qwik: 1.7.3 => 1.7.3
@builder.io/qwik-city: 1.7.3 => 1.7.3
typescript: 5.4.5 => 5.4.5
undici: 5.28.4 => 5.28.4
vite: 5.2.11 => 5.2.11
Additional Information
No response