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

Broken Async Components in Hono #25278

Closed
sant123 opened this issue Aug 28, 2024 · 3 comments
Closed

Broken Async Components in Hono #25278

sant123 opened this issue Aug 28, 2024 · 3 comments

Comments

@sant123
Copy link

sant123 commented Aug 28, 2024

Version: Deno 1.46.1

Please see https://hono.dev/docs/guides/jsx#async-component

Hello! Please take a look at this example:

/** @jsxImportSource jsr:@hono/hono/jsx */
import { delay } from 'jsr:@std/async';
import { Hono } from 'jsr:@hono/hono';

const app = new Hono();

function SyncComponent() {
  return <h1>Hello from Sync component!</h1>;
}

async function AsyncComponent() {
  await delay(1000);
  return <h1>Hello from Async component!</h1>;
}

app.get('/sync', (c) => {
  return c.html(<SyncComponent />);
});

app.get('/async', (c) => {
  return c.html(<AsyncComponent />);
});

Deno.serve(app.fetch);

This code works on Deno v1.45.5 but not on later versions. Please take a look on the different behaviors:

v1.45.5

Screencast.from.2024-08-28.16-26-48.mp4

v1.46.1

Screencast.from.2024-08-28.16-29-06.mp4

Deno v1.46.1 for some reason returns an empty response, also if you trigger many requests the server crashes with the following error:

image

Do you know what is happening here?

Thanks.

@bartlomieju
Copy link
Member

This might be caused by the same problem that prompted: #25207. Can you try with latest canary?

@sant123
Copy link
Author

sant123 commented Aug 28, 2024

It works with canary, you are the best. Thank you!

@lucacasonato
Copy link
Member

lucacasonato commented Aug 29, 2024

Closing as dupe of #25203

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants