Repository navigation
A state resolves from its registered place only; saving the global state stores the saved global config (3.0.4) - #57
Merged
Conversation
…ate stores the saved global config A state's resolved values are computed from its own object, the states registered above it and the global config. build_context_stack, the one place a state builds its layers, now starts from the global config whatever config_context the caller has entered: the caller's context is set aside for the block and active again after it. Before, the state's layers were stacked on the caller's, so the caller's layers beat the global config, were taken whenever a field happened to be resolved inside a block, were kept afterwards, and were reported under scopes where nothing is registered. Plain attribute access on a lazy object that no state owns is unchanged and reads the entered context. Closes #53. mark_saved on the state of a global config stores its saved object as the saved global config before any descendant resolves again. The state already wrote the store on edit, restore, instance replacement and time travel; save was the one operation left to the application, which made the result depend on whether the application called set_saved_global_config before or after. Both orders, and mark_saved alone, now end the same: descendants' saved values follow the saved global and nothing stays dirty. dirty_fields is a read like the other resolved reads: it compares the sources first, so it no longer answers from before a source change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #53. Releases 3.0.4.
A state's resolved values depend only on its place in the registered hierarchy
build_context_stackis the one place a state builds its resolution layers (both callers are inObjectState). It now starts from the global config whateverconfig_contextthe caller has entered: the caller's context is set aside for the block and active again after it. Before, the state's layers were stacked on the caller's, so the caller's layers beat the global config, were taken whenever a field happened to be resolved inside a block, were kept afterwards and were reported under scopes where nothing is registered.Plain attribute access on a lazy object that no state owns is unchanged and reads the entered context.
Saving the state of the global config stores the saved global config
mark_savedon the state of a global config stores its saved object as the saved global config before any descendant resolves again. The state already wrote the store on edit, restore, instance replacement and time travel; save was the one operation left to the application, so the result depended on whether the application calledset_saved_global_configbefore or aftermark_saved. All three sequences (save only, save then store, store then save) now end the same and tell registered descendants the same things in the same order.dirty_fieldscompares the sources first, like the other resolved reads. On 3.0.3 it answered from before a source change until another read happened.The single-owner design for the rest (first store at registration, the setters' remaining purpose, the
clear_current_temp_global()calls) is #56.Tests
tests/test_resolved_values_follow_registered_ancestors.py:19 of these fail on 3.0.3. Full suite: 388 passed on 3.12 and 3.11 in fresh venvs. pyqt-reactive main (593 passed, 1 skipped) and formbridge main (108 passed) give the same results on 3.0.3 and on this branch.
🤖 Generated with Claude Code