Fix ClientStateVar late mount default sync - #6824
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
hey @adhami3310 can you go through this ? |
Greptile SummaryThis PR corrects late-mounted global
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the explicit undefined check preserves a shared null during late mounting, resolving the previously reported issue.
|
| Filename | Overview |
|---|---|
| reflex/experimental/client_state.py | Adds a lazy global-state initializer with an explicit undefined check, correctly preserving shared null values while leaving local initialization unchanged. |
| tests/units/test_client_state.py | Verifies generated hooks for shared-ref initialization, explicit null preservation, undefined fallback, and local-state isolation. |
| tests/integration/tests_playwright/test_client_state.py | Covers the late-mount synchronization flow and confirms both consumers update when shared state returns to its default. |
| news/6823.bugfix.md | Accurately documents the corrected late-mounted global client-state behavior. |
Reviews (4): Last reviewed commit: "Merge branch 'main' into fix/client-stat..." | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
|
can you add the repro as integration test |
|
Added the repro as a Playwright integration test in 45c088e. It follows the issue scenario: push the global |
Fixes #6823
Summary
Fixes a global
ClientStateVarrendering bug where a component that mounted while the shared value was non-defaultcould get stuck when the value was later pushed back to the default.
Changes
ClientStateVarlocal state from the sharedrefsmirror when available.useState(default)behavior for non-global client state.undefinedTesting
uv run pytest tests/units/test_client_state.py -quv run pytest tests/units/compiler/test_memoize_plugin.py -k client_state -quv run ruff check reflex/experimental/client_state.py tests/units/test_client_state.pyuv run ruff format --check reflex/experimental/client_state.py tests/units/test_client_state.pyuv run pyright reflex/experimental/client_state.py tests/units/test_client_state.pyuv run towncrier check --config pyproject.toml --dir . --compare-with origin/main