fix: reinitialize .web when the frontend template changes

BE
1d ago
+214-5

reflex run/export/compile reinitialize .web only when reflex.json records a different Reflex version. A frontend template change that keeps the version never reaches an existing .web: in an editable install (WEB_TEMPLATE reads packages/reflex-frontend/src in place, but the version metadata is fixed at install time) or in a fork that doesn't bump it, a new utils/helpers/*.js is missing (Could not load utils/helpers/... on export) and a changed one stays stale until .web is deleted by hand.

reflex.json now also stores a sha256 over the template tree's relative paths and contents (web_template_hash), and needs_reinit() compares it next to the version. It is computed once per process and only when the version matches, about 0.5-3 ms for the 27 template files. The refresh goes through the existing reinit path, so it does exactly what a version bump does today. A reflex.json without the key reinitializes once.

Tests: the hash changes on a changed, added, removed or moved file (and on bytes moved between files), needs_reinit() covers version, missing key and template change, and an end-to-end test runs the real initialize_web_directory(), edits the template and checks that the edit and the project hash land in the refreshed .web.