bikeshaving / crank

The Just JavaScript Framework
https://crank.js.org
MIT License
2.7k stars 75 forks source link

Errors being swallowed in the second async component of a race. #253

Closed brainkim closed 1 year ago

brainkim commented 1 year ago
import {jsx} from "@b9g/crank/standalone";
import {renderer} from "@b9g/crank/dom";

async function One() {
  await new Promise((r) => setTimeout(r, 1000));
  return jsx`<div>Hello</div>`;
}

async function Two() {
  await new Promise((r) => setTimeout(r, 2000));
  throw new Error("What the fuck");
  return jsx`<div>World</div>`;
}

async function *Loader() {
  for await ({} of this) {
    yield jsx`<${One} />`;
    yield jsx`<${Two} />`;
  }
}

renderer.render(jsx`<${Loader} />`, document.body);

Expected: The error is observable in the console. Actual: Nothing.

brainkim commented 1 year ago

Fixed in 0.5.3