framesurge / perseus

A state-driven web development framework for Rust with full support for server-side rendering and static generation.
https://framesurge.sh/perseus/en-US
MIT License
2.15k stars 89 forks source link

Using global state in a Capsule as well as a Template leads to unreachable code being reached at build-time #280

Closed Miroito closed 1 year ago

Miroito commented 1 year ago

This issue is reporting a bug in the code of Perseus. Details of the scope will be available in issue labels. The author described their issue as follows:

Using global state in a capsule and a template where this capsule is used panics at build-time

The steps to reproduce this issue are as follows:

See MRE.

A minimum reproducible example is available at https://github.com/Miroito/capsule-global-state.

Tribble internal data dHJpYmJsZS1yZXBvcnRlZCxDLWJ1ZyxBLWRlcGxveW1lbnQ=
arctic-hen7 commented 1 year ago

This is actually very easy to fix: Perseus does the logical thing and internally caches any global state from the server the first time it's accessed, but that should not be happening on the server-side, which it is! This should be a trivial fix.

arctic-hen7 commented 1 year ago

I'll release v0.4.1 with this fix ASAP.