Skip to content

[🐞] v2: render function behavior #8169

@wmertens

Description

@wmertens

Which component is affected?

Qwik Runtime

Describe the bug

In v2, tasks that return Promises throw those Promises, forcing re-running after completion, but in v1 they just chain on a single Promise that is awaited.

Reproduction

/

Steps to reproduce

import { component$, useTask$, useSignal } from '@builder.io/qwik';

export default component$(() => {
  console.log('before')
  useTask$(async ({ track }) => {
    console.log('task A');
    await 5
    console.log('task A async');
  });
  console.log('between');
  useTask$(async ({ track }) => {
    console.log('task B');
    await 5
    console.log('task B async');
  });
  console.log('after')
  return (
    <div>hi</div>
  );
});

in v1 this gives

 before
 task A
 between
 after
 task A async
 task B
 task B async

and in v2

 before
 task A
 task A async
 before
 between
 task B
 task B async
 before
 between
 after

the v1 behavior is correct

System Info

/

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions