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 SummaryFixes late-mounted global
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously reported explicit-null issue is resolved because the initializer now falls back only when the shared value is
|
| Filename | Overview |
|---|---|
| reflex/experimental/client_state.py | Initializes global client state from the shared ref using an undefined-only fallback, while preserving the local-state path. |
| tests/units/test_client_state.py | Covers shared-ref initialization, explicit null preservation, undefined fallback, and local-state isolation. |
| tests/integration/tests_playwright/test_client_state.py | Exercises synchronization when a component mounts after a global value changes and the value later returns to its default. |
| news/6823.bugfix.md | Documents the corrected late-mount synchronization behavior. |
Reviews (3): Last reviewed commit: "Add ClientStateVar late mount integratio..." | 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