[🐞] await nav() inside useTask$ not working
Which component is affected?
Qwik Runtime
Describe the bug
when i use nav() with await it does not work, if i remove await it works!
Reproduction
https://stackblitz.com/edit/github-76jcpj?file=src%2Froutes%2Findex.tsx
Steps to reproduce
I used this test code in the routes/index.tsx of the demo
export default component$(() => {
const nav = useNavigate();
const visible = useSignal(false);
useVisibleTask$(async () => {
visible.value=true;
});
useTask$(async ({track})=>{
track(visible);
if(visible.value){
await nav("/demo/flower/");
}
}
);
return (....)
but it works if i remove the await keyword. it will also works if i put it with the await keyword inside useVisibleTask$,
System Info
System:
OS: Linux 6.10 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
CPU: (8) x64 Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz
Memory: 8.71 GB / 15.60 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 21.6.2 - ~/.nvm/versions/node/v21.6.2/bin/node
npm: 10.2.4 - ~/.nvm/versions/node/v21.6.2/bin/npm
pnpm: 9.12.0 - ~/.local/share/pnpm/pnpm
bun: 1.0.3 - ~/.bun/bin/bun
Browsers:
Brave Browser: 129.1.70.117
Chrome: 129.0.6668.58
npmPackages:
@builder.io/qwik: ^1.9.1 => 1.9.1
@builder.io/qwik-city: ^1.9.1 => 1.9.1
typescript: 5.4.5 => 5.4.5
undici: * => 6.20.1
vite: 5.3.5 => 5.3.5
Additional Information
No response
this may be fixed in v2, we're releasing the alpha soonish
Thanks, are there any docs about v2 and breaking changes to start preparing for it or testing it?
Thanks, are there any docs about v2 and breaking changes to start preparing for it or testing it?
I started working on it. Breaking changes will be very minimal, for now, here are the 2 main ones:
-
useComputeddoesn't accept async functions anymore -
<button>can contain only phrasing content as per HTML5 spec so any non-phrasing content (e.g.divinsidebutton) will be rejected (error)
The packages will also be renamed from @builder.io/qwik to @qwik.dev/core, @qwik.dev/city (or routing), etc. but there will be a script to change it for you.
Great, thank you @ianlet, any ETA for v2?
I tested with v2 codebase and it's not working
I tested with the latest v2 release and nav is not working with await.
thanks @gioboa , what about nav() without params to refresh the page, I think it is also not working form.
@Varixo do we have a decision on this?