Closed jessezhang91 closed 6 months ago
Start a new pull request in StackBlitz Codeflow.
So the problem is that Link uses useContext and the contextProvider hasn't started.
This feels like a bug to me, I would expect useContext to wake up the provider first on resume.
it's a bug, but it's not about waking up, it's about the context was not serialized, when it should, I will look into it with priority
probably the same issue but this is happening when conditionally rendering links in a Resource as well.
Im having this exact same problem qwik v1.2.19
@jmsegrev minimaal repro please, preferably in the playground.
Are you sure it's not because you're rendering slots optionally and the children don't see the context provided by a needed slot?
@wmertens you are correct, it seems related to the condition. Here I replicated it with a simple condition. It does not seem to be the correct behavior. (check the browser console for the error). https://stackblitz.com/edit/qwik-starter-ccnona?file=src%2Froutes%2Findex.tsx
This issue still persists with
"@builder.io/qwik": "^1.4.5",
"@builder.io/qwik-city": "^1.4.5",
Minimal example (nearly the same as what @jmsegrev given above)
import { component$, useSignal } from "@builder.io/qwik";
import { Link, type DocumentHead } from "@builder.io/qwik-city";
export default component$(() => {
const clicked = useSignal(false);
return (
<>
<button
onClick$={() => {
clicked.value = true;
}}
>
Click me
</button>
{clicked.value && <Link href="https://google.com">Hello</Link>}
</>
);
});
@wmertens Can we re-open the issue?
The reason is that in this repro nothing is using the qwik city context during SSR, so it's not sent along with the state.
Actually, this is basically a duplicate of #5411
Qwik Version
0.12.1
Operating System (or Browser)
Mac OSX
Node Version (if applicable)
No response
Which component is affected?
Qwik City
Expected Behaviour
I do not expect to see this error when conditionally rendering
Link
s based on a value updated inuseClientEffect$
.Actual Behaviour
Reproduced here: https://stackblitz.com/edit/qwik-starter-z3bthd?file=src/root.tsx
Error:
Additional Information
No response