Repository navigation
Load a layout's variables and conditions even when they arrive after it - #73
Merged
Merged
Conversation
A downloaded layout was added to the publish model before its variables and conditions finished downloading. Any rebuild in that window (another layout emitting the model, the status stream) built the layout without them, and CodelesslyLayoutBuilder only reloads when the layout itself changes, so the layout stayed without them: conditions never applied and set variable actions found no variable. A layout cached without them had the same result. The data manager now adds a downloaded layout only after its variables and conditions, and the layout builder reloads when they change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B86QWEkjWBfHUrfXKRv6i5
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.
Requested by Ray · project thread
Before: a layout could render without its variables and conditions. In the editor's onboarding survey (layout
0RAA1RWimj5i1rmAD0OR), clicking an option didn't select it and the first step bar wasn't highlighted.After: the layout always runs with its variables and conditions, so options select on click and the step bars highlight.
DataManager.getOrFetchPopulatedLayoutadded a downloaded layout to the publish model before awaiting its variables and conditions.CodelesslyWidgetbuilds a layout as soon as the model holds it, andCodelesslyLayoutBuilder.loadLayoutreads variables and conditions only then. ItsdidUpdateWidgetreloads only when the layout's id, canvas orlastUpdatedchanges. So any rebuild in that window left the layout without them for good: conditions never applied, and set variable actions found no variable to set. Rebuilds there are common withpreload: true, where other layouts emit the model, or when the status stream changes. A layout cached without its variables and conditions ends up the same way.How:
CodelesslyLayoutBuilderremembers the variables and conditions it loaded, and reloads when the publish model holds different ones for the layout. This also picks up a publish that changes only conditions or variables.test/layout_loading_test.dartcovers both cases with the survey's option tile as a fixture. Both tests fail without the fix.flutter analyzeis clean and all 71 tests pass.Rendering the full survey layout headless works on 7.3.0 when the variables and conditions are loaded, so the condition and formula changes in #71 are not the cause.
Generated by Claude Code