Skip to content
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

[🐞] await nav() inside useTask$ not working #6993

Open
lbensaad opened this issue Oct 21, 2024 · 5 comments
Open

[🐞] await nav() inside useTask$ not working #6993

lbensaad opened this issue Oct 21, 2024 · 5 comments
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working

Comments

@lbensaad
Copy link
Contributor

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

@lbensaad lbensaad added STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working labels Oct 21, 2024
@wmertens
Copy link
Member

this may be fixed in v2, we're releasing the alpha soonish

@lbensaad
Copy link
Contributor Author

Thanks, are there any docs about v2 and breaking changes to start preparing for it or testing it?

@ianlet
Copy link
Contributor

ianlet commented Oct 26, 2024

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:

  • useComputed doesn't accept async functions anymore
  • <button> can contain only phrasing content as per HTML5 spec so any non-phrasing content (e.g. div inside button) 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.

@lbensaad
Copy link
Contributor Author

Great, thank you @ianlet, any ETA for v2?

@gioboa
Copy link
Member

gioboa commented Nov 27, 2024

I tested with v2 codebase and it's not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants