feat(solid): @SolidQuery previousState (annotations dev.3 + generator dev.7) - #113
Merged
Merged
Conversation
… tracked-read solid_annotations 3.0.0-dev.3: add a previousState source-time stub on the @SolidQuery tear-off (<query>.previousState), mirroring Resource.previousState. Reads as <query>.previousState?.asReady?.value and lets a consumer show the value the resource retained across a failed refresh (retention holds with the default useRefreshing: true). solid_generator 3.0.0-dev.7: recognize <query>.previousState (a tear-off property, not the <query>() call) as a tracked read so the enclosing build() gets a SignalBuilder wrap + flutter_solidart import, byte-identical (lib resolves to Resource.previousState). Same-class and cross-instance, the latter origin-qualified via the existing #110 machinery. Mirrors the .previousValue/.hasValue wiring for @SolidState. Two goldens prove a build reading only .previousState is still wrapped + imported.
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.
What
Adds
<query>.previousStatesupport so a@SolidQueryconsumer can read the value the resource retained from before a failed refresh (aResourceErrorotherwise drops it), keeping UI populated instead of blanking on a transient reload failure.solid_annotations 3.0.0-dev.3
previousStatesource-time stub on theRefreshFuture/RefreshStreamtear-off extensions. Reads as<query>.previousState?.asReady?.value, mapping toResource.previousStateat lib-time. Retention holds with the defaultuseRefreshing: true(documented).solid_generator 3.0.0-dev.7
<query>.previousState(a tear-off property, not the<query>()call) as a tracked read, so the enclosingbuild()gets aSignalBuilderwrap +flutter_solidartimport — byte-identical, no source edit. Same-class and cross-instance; the cross-instance path reuses the origin-qualified_queryNamesForCrossClassName(Name-keyed registry cannot disambiguate a local plain class from a foreign reactive class with the same name #110) so a same-named non-query method is never spuriously tracked. Mirrors the existing.previousValue/.hasValuewiring for@SolidStatefields.build()reading ONLY.previousState(no<query>()call) is still wrapped + imported;.refresh()stays untracked.Tests
solid_generator: 360 tests pass (2 new goldens + idempotency, no regressions). Both packagesdart analyzeclean.