Avoid root dirty delta for shared state events
HA
4h ago+966+966+012345678901234567890123456789-16-16-01234567890123456789
Summary
- Preserve and restore root dirty state around the temporary router dirtying used by linked/shared state patching.
- Prevent regular linked-state events from sending an unchanged root/router delta.
- Add regression coverage for the issue described in #6392.
Tests
uv run --frozen pytest tests/units/test_state.py::test_linked_state_event_does_not_dirty_root_state -quv run --frozen pytest tests/units/test_state.py::test_linked_state_event_does_not_dirty_root_state tests/units/test_state.py::test_router_var_dep tests/units/test_state.py::test_computed_var_depends_on_parent_non_cached tests/units/test_state.py::test_async_computed_var_get_state -quv run --frozen pytest tests/units/test_state.py -quv run --frozen pre-commit run --files reflex/istate/shared.py tests/units/test_state.py news/6841.bugfix.md
Closes #6392