exhibitionist-digital / ultra

Zero-Legacy Deno/React Suspense SSR Framework

Home Page:https://ultrajs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useAsync inside dynamically imported components doesn't work as intended on first run

b3nten opened this issue · comments

useAsync calls inside of dynamically imported components push the callback into the dataStream context after the stream has finished. This means that they don't stream to the client. This only occurs the first time the server renders a page. Subsequent requests work as intended.

Here is a github repo that demonstrates this.
https://github.com/B3nten/useAsync-repro

I currently have no idea why it works okay on subsequent requests, but as it does so I think it should be possible to fix.

Reproduction:
https://github.com/B3nten/ultra/tree/async-debug

Steps:

  1. Run deno task dev, chose 18 (with-react-router).
  2. Note console output on full refresh of pages Home and About
  3. Note difference in output on subsequent refreshes of About
  1. ./about.html and ./ABOUT2.html are the returned responses from /about, on first request and second.