Skip to content

feat(solid): @SolidQuery previousState (annotations dev.3 + generator dev.7) - #113

Merged
nank1ro merged 1 commit into
mainfrom
feat/query-previous-state-stub
Aug 28, 2026
Merged

nank1ro merged 1 commit into
mainfrom
feat/query-previous-state-stub

Conversation

@nank1ro

@nank1ro nank1ro commented Aug 28, 2026

Copy link
Copy Markdown
Owner

What

Adds <query>.previousState support so a @SolidQuery consumer can read the value the resource retained from before a failed refresh (a ResourceError otherwise drops it), keeping UI populated instead of blanking on a transient reload failure.

solid_annotations 3.0.0-dev.3

  • previousState source-time stub on the RefreshFuture/RefreshStream tear-off extensions. Reads as <query>.previousState?.asReady?.value, mapping to Resource.previousState at lib-time. Retention holds with the default useRefreshing: true (documented).

solid_generator 3.0.0-dev.7

  • Recognizes <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, 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/.hasValue wiring for @SolidState fields.
  • Two goldens prove a 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 packages dart analyze clean.
  • Verified end-to-end in a consuming app (roster survives a failed refresh with an inline error).

… 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.
@nank1ro
nank1ro merged commit 176ae77 into main Aug 28, 2026
1 check passed
@nank1ro
nank1ro deleted the feat/query-previous-state-stub branch August 28, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant