tw-in-js / use-twind-with

Twind integration packages for frameworks & libraries with examples
MIT License
68 stars 17 forks source link

fix: prerender not awaiting sheet reset #19

Closed rschristian closed 3 years ago

rschristian commented 3 years ago

Fixes #17

The issue I was running into was when multiple links lead to the same content. Say neither /foo nor /bar existed, so both urls would lead to a 404 page.

/foo (the 404 page) would have the correct styles, but /bar would not. /bar would be missing the content specific to the 404 page, but oddly, not the global styles (like header, page background, etc. Still not entirely sure why this is, but I'm not curious enough to go looking).

Finally realized it was the sheet only finishing it's reset after the next page had been prerendered. Just needed to insert an await to ensure the reset finished before prerendering the next page, else any common / shared styles would be removed.

sastan commented 3 years ago

Thank you!

sastan commented 3 years ago

Published as @twind/wmr@1.0.9

rschristian commented 3 years ago

Awesome, thanks!