-
Notifications
You must be signed in to change notification settings - Fork 17
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
in WMR prerender: asyncVirtualSheet reset() is not a Promise, yet is awaited #26
Comments
Mhmm, this appears to be the cause of bug #25 |
No, it's not. So this was my doing, and honestly, was just the result of trial and error. Without awaiting the reset, when pages that would share styles (say Twind utilizes Node's If there's a better solution I'd love to see it. Edit: See below for better reproduction of the original issue |
but |
As I said:
Truly, I don't know, I think it was a misplaced It very well could be some race condition that |
Probably a side effect of Node's |
Here's a fresh reproduction repo, as the instructions I wrote above kinda suck: https://github.com/rschristian/twind-empty-duplicate-page-bug Post install, this patches You can then add the I haven't yet been able to break this, though I agree it's probably some sort of side effect that I'd think will fall apart eventually. |
Thank you for the repro repo Ryan. Regarding Because of my specific functional requirements (notably: true zero-runtime Twind, i.e. Twind only used at build time), I decided early-on not to use My custom build system ensures that each prerendered SSR'd HTML file contains "critical" inline CSS sufficient for its own presentation, and that each such HTML file also references "secondary" external CSS for all other hydrated / CSR'd routes. In order to completely remove Twind's runtime, I implemented additional pre- and post- WMR build steps that compute "critical" vs. "secondary" styles ... similar in spirit to Twind's own "extract CSS" utility, but not just based on static analysis of used classes, instead I use a Preact The "critical" inline styles are prerendered / SSR'd inside the Crucially: there is no overlap / redundancy between "critical" and "secondary" stylesheet rules, in order to minimise footprint and network traffic. There is possibly a caveat with respect to the specificity of some CSS selectors, but so far I have not hit this edge case. Anyway, long story short: I would have to look into the specifics of UPDATE: I forgot to mention that ; of course ; the Twind "zero runtime" approach only applies to my WMR production builds, not the development server which does everything dynamically :) |
use-twind-with/packages/wmr/prerender.ts
Line 25 in d40071a
...but:
https://github.com/tw-in-js/twind/blob/15441649dcdfb97fba56e0cc8870f08485cfc1c6/src/server/index.ts#L73-L85
The text was updated successfully, but these errors were encountered: