tanquery 0.5.0
tanquery: ^0.5.0 copied to clipboard
TanStack Query for Dart. Automatic caching, stale-while-revalidate, background refetching, mutations with optimistic updates, infinite queries. Pure Dart - no Flutter dependency.
0.4.0 #
Bug Fixes #
- Error reducer no longer sets
isInvalidated: true-- Matches TanStack Query behavior. Previously, errored queries were always marked invalidated, causing aggressive refetch loops on focus/reconnect for queries that consistently fail. Now theisInvalidatedflag is preserved through errors. invalidateQueries(refetchType: QueryTypeFilter.all)now correctly refetches all queries -- Previously dropped therefetchTypeparameter and defaulted toactiveonly.refetchQueries()no longer leaks futures for paused queries -- Now checks paused state before initiating fetch instead of after.
Improvements #
Query._abortSignalConsumedproperly wired toRetryer.isAbortSignalConsumed--removeObserver()now correctly chooses betweencancel(revert: true)andcancelRetry()based on whether the abort signal was consumed by the query function.isDisabled()simplified -- Removed tautological branch that always returned false.- Unsafe null assertions removed --
QueryCacheconfig callbacks (onSuccess,onError) now accept nullable data/error, preventing runtime crashes with nullableTDatatypes.
Dead Code Removed #
- Removed
isStatic()method (always returned false, never called) - Removed
setCacheNotify()method (never called externally) - Removed
FetchDirectionenum (unused across entire monorepo) - Removed
EventType.observerResultsUpdatedandEventType.observerOptionsUpdated(never emitted) - Removed
StaleTime.zeroandStaleTime.isZero(never used) - Removed unnecessary
latekeyword onQueryKey.queryHash
0.2.0 #
Improvements #
- Updated repository URL to https://github.com/OttomanDeveloper/tanquery
- Comprehensive beginner-friendly README with progressive disclosure
- Before/after comparisons, API reference tables, architecture diagram
0.1.0 #
Initial Release #
- QueryClient with mount/unmount lifecycle and reference counting
- QueryCache with build-or-get pattern, partial key matching, garbage collection
- Query state machine with 8-action reducer and two-axis state model (QueryStatus + FetchStatus)
- QueryObserver with select (3-level memoization), placeholderData, stale timer, refetch interval
- Retryer with exponential backoff (1s-30s cap), pause/continue/cancel, 3 network modes
- MutationCache with scoped sequential execution via canRun/runNext
- Mutation with exact TanStack callback ordering (cache-level before instance-level)
- MutationObserver with mutate (fire-and-forget) and mutateAsync (awaitable)
- Hydration/dehydration for cache persistence with error redaction
- StreamedQuery for real-time data (WebSocket, SSE, LLM streaming) with 3 refetch modes
- Structural sharing via replaceEqualDeep (depth limit 500)
- InMemoryQueryStorage with copy-on-read/write
- skipToken for type-safe conditional queries
- StaleTime.static_ for never-stale data
- 310 tests