-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Interesting! In my tests, I can reliably reproduce sheet.target.length === 0
on the very first invocation of prerender
(typically: index.html
), UNLESS I yield CPU cycles immediately after sheet.reset()
(before prerender()
). I presume this gives the message pump some time to flush (async_hook
-related behaviour?)
example-wmr/public/prerender.js
Lines 12 to 14 in def977b
sheet.reset() | |
const result = await prerender(app) |
This works
await new Promise((res) => setTimeout(res, 0));
...at first I tried 1s, and realised it only needed a "defer" with zero delay), so I used this instead:
await new Promise((res) => process.nextTick(res));
I only do this on first render, and I throw an exception if !sheet.target.length
immediately after prerender()
.
Fun edge cases :)
Metadata
Metadata
Assignees
Labels
No labels