tanquery 0.8.0
tanquery: ^0.8.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.8.0 #
Type Safety #
- Added
finalclass modifier to all data/value types:QueryKey,QueryState,MutationState,InfiniteData,StaleTime,CancelledError,QueryCacheEvent,MutationCacheEvent,QueryObserverResult,MutationScope,MutationConfig,CacheLevelCallbacks,DehydratedQuery,DehydratedState,DehydrateOptions,InMemoryQueryStorage. - Added
abstract interfaceclass modifier toQueryStorageandQueryUpdateCallbackto enforce implement-only contracts. - These modifiers tell Dart's type system how each class is meant to be used.
finalclasses can't be extended or implemented outside the package.interfaceclasses can be implemented but not extended.
0.7.1 #
Documentation #
- Added dartdoc comments to all public APIs: classes, methods, fields, typedefs, enums, enum values, constructors, and top-level functions.
0.7.0 #
Bug Fixes #
- Structural sharing cast failure fixed --
replaceEqualDeepreturnedList<Object?>instead ofList<T>when queries were accessed through untypedQueryreferences (e.g., frominvalidateQueries→refetchQueries→findAll). Now safely checksshared is TDatabefore casting, falling back to original typed data. catchErrortype mismatch fixed -- Replaced allcatchError((_) => null)and.ignore()withasync/try/catchor.then((_) {}, onError: (_) {})patterns. Prevents "The error handler of Future.catchError must return a value of the future's type" runtime error.refetchQueriesno longer leaks futures -- Usesasync/try/catchinstead of chained.then().catchError().
0.6.0 #
Bug Fixes #
setQueryDatawith function updater no longer crashes when no prior data exists -- Now acceptsTData? Function(TData?)for nullable-safe updates instead of force-casting to non-nullable.- Custom
focusManager/onlineManageron QueryClient now propagated to all queries -- Previously only affected MutationCache and mount lifecycle. Now QueryCache passes them through to every Query created viabuild(). MutationObserverper-call callbacks no longer silently skipped --onSuccess/onError/onSettledfrommutate()args now fire regardless of subscriber count. Previously gated byhasListeners.Query.reset()now notifies observers and reschedules GC -- Previously set state directly (bypassing_dispatch), causing memory leaks (no GC timer) and devtools missing the reset.
0.5.0 #
Improvements #
- Removed
Retryer.markAbortSignalConsumed()-- Dart has no AbortSignal equivalent. The mechanism was scaffolding with no call path.removeObserver()simplified to always usecancelRetry(). - Removed
QueryObserver._onlineManager-- TanStack's QueryObserver has zero onlineManager reference. All online-awareness correctly delegated to Query/Retryer layers. - Wired DevTools status filter -- Added clickable status filter chips (all/fresh/stale/fetching/paused/error/inactive) to the query list panel.
QueryListViewnow filters by status.
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