Repository navigation
Releases: Jcparkyn/phetch
Releases · Jcparkyn/phetch
Release list
v1.0.0
🎉 Version 1.0! No new features, but after much procrastination I'm confident that Phetch is stable and ready to release properly.
Changed
- BREAKING CHANGE:
SetArgAsync,RefetchAsync, andTriggerAsyncno longer throw an exception if the query function fails, and instead return aQueryResult<T>type which is either a success or failure.- This makes them safer to use as callbacks in your Blazor components, but in most cases you should still use the non-async versions (
SetArg,Refetch,Trigger). - To migrate code using these methods without changing the functionality, simply replace
await query.SetArgAsync(..)with(await query.SetArgAsync(..)).GetOrThrow().
- This makes them safer to use as callbacks in your Blazor components, but in most cases you should still use the non-async versions (
Removed
- BREAKING CHANGE: Removed the old
Mutation<TArg>class which was previously marked obsolete. UseQuery<TArg, Unit>instead, which is equivalent. - BREAKING CHANGE: Removed the old
Skipoption on<UseEndpoint/>, which was previously marked obsolete. UseAutoFetchinstead.
v0.7.1
Added
- New
RefetchIntervaloption on queries to automatically re-fetch a query on a fixed interval.
Changed
- Some minor improvements to type definitions for
Querymethods (non-breaking). - Improved docs for async
Querymethods.
Development
- More tests.
v0.7.0
Added
- The non-generic
QueryOptionsclass can now be implicitly cast toQueryOptions<TArg, TResult>. - New
DataChangedevent for queries, which is triggered whenever theDataproperty changes.
Changed
- BREAKING CHANGE: If a query succeeds and then fails on a refetch,
query.Datanow returnsnull/default, instead of the old data. Also,query.LastDatanow returns the data from the last successful request (even if the arg was different) instead ofnull/default. QueryOptions.OnSuccessis now called when a cached result is returned (unless it's stale). Note:EndpointOptions.OnSuccessis unchanged, and still won't be called when a cached result is returned.
Development
- More tests.
- Sample project improvements.
v0.6.0
Added
- New DocFX site for documentation
- Updated docs for CacheTime and StaleTime
- If you're targeting .NET 8, you'll now have proper hot reload support in components containing
<UseEndpoint/>or<ObserveQuery/>. This isn't specific to this version of Phetch, but worth mentioning anyway. UseEndpointInfinite.LoadNextPageAsyncnow returns the result of the next page query, or throws if the next page can't be loaded yet (e.g., the last page failed).
Changed
- BREAKING CHANGE:
<ObserveQuery/>no longer detaches queries automatically when disposed. To keep the same behaviour as before, setDetachWhenDisposed="true", or explicitly callquery.Dispose()in theDisposemethod of your component. - BREAKING CHANGE: Changed the function signature for the
GetNextPageArgoption of<UseEndpointInfinite/>. - Removed the
<UseMutationEndpoint/>component that was previously marked as[Obsolete].
Fixed
- Fixed events not being properly unsubscribed when
<ObserveQuery/>was disposed. - Fixed failed queries in cache not automatically re-fetching if they have previously succeeded.
Development
- Lots more tests.
- Upgraded sample projects to .NET 8
Full Changelog: v0.5.1...v0.6.0
v0.5.1
Changed
- Queries now trigger a
StateChangedevent when they begin fetching. This makes the behavior a bit more predictable when using endpoints across multiple components. - Improved docs for
<ObserveQuery/>.
Added
- New
onSuccessandonFailurecallback parameters forquery.Trigger()methods, which get called when the query succeeds or fails, respectively. Thanks to @Paxol for suggesting this.
Full Changelog: v0.5.0...v0.5.1
v0.5.0
Changed
- BREAKING CHANGE: Removed public constructors for
Querythat were previously deprecated. - BREAKING CHANGE: Renamed
MutationEndpoint<T>toResultlessEndpoint<T>for better consistency. The oldMutationEndpoint<T>has been marked as obsolete, and left in temporarily to make migration easier. Also removedMutation<T>and<UseMutationEndpoint/>, which can safely be replaced withQuery<T, Unit>and<UseEndpoint/>. - Moved some of the methods on
Query<T>to extension methods, so that they would also work on the equivalentQuery<Unit, T>class. - Lots of improvements to documentation and samples.
- More tests.
Fixed
- Fixed some issues that arise when
SkipandArgparameters ofUseEndpointare changed simultaneously.
Full Changelog: v0.4.0...v0.5.0
v0.4.0
Added
Endpoint.TryGetCachedResultmethod, to retrieve a cached result synchronously for the given query argument.- New
IQueryandIQuery<TArg, TResult>interfaces, to help with testing or writing methods that operate on queries. - Lots more tests (currently 96% line coverage in
Phetch.Core). - Lots of improvements to the sample projects (in samples).
Changed
- Public constructors for
Queryare now deprecated, because they serve very little value since adding Endpoints. Instead, just create an endpoint and call.Use(). These constructors will be removed in a future release.
Fixed
- Exceptions in
OnSuccess/OnFailurecallbacks are now caught, instead of being incorrectly treated as a query failure.
v0.3.1
Added
- Lots more tests
QueryandEndpointclasses now have a publicOptionsproperty to read the options that were passed to them.Querynow has aCurrentQueryproperty to get theFixedQuerythat it is currently observing.- New
KeySelectoroption to customize the value used for caching query arguments. - Support for infinite
StaleTimeby passing a negative value
Changed
RefetchAsyncand similar methods now return the result data from the query.
Fixed
- BREAKING CHANGE:
Query.Refetchnow throws an exception if it is un-initialized, instead of failing silently. nullcan now be used as a query argument.- Fixed bug where large
StaleTimevalues (e.g., `TimeSpan.MaxValue) would cause an overflow.
v0.3.0
Added
- New parameter for
UpdateQueryDatato optionally insert a new cache entry if one doesn't already exist for the given argument. - Read-only
Argproperty onQueryclass, to access the last argument passed toSetArg. - Option to pass child content directly to
<ObserveQuery/>, so that only the child content is re-rendered when the query updates. When using this method, there is no need to pass theOnChanged="StateHasChanged"parameter. - New
RetryHandleroption for endpoints and queries, to control whether and how the query retries upon failure. - New non-generic
EndpointOptionsandQueryOptionsclasses, which can be used to share "default" settings between endpoints and queries. - New experimental
<UseEndpointInfinite/>component for creating "infinite scroll" features. To use this, add@using Phetch.Blazor.Experimentalto your_Imports.razor.
Changed
- BREAKING CHANGE: Removed the return value from
UpdateQueryData - BREAKING CHANGE: Removed the
argparameter fromInvalidateWhere. Instead, use theArgproperty of the query. - Various improvements to documentation and sample projects.
v0.2.0
Added
- New
GetCachedQuerymethod onEndpointto look up a cache entry.- The returned cache entry can also be invalidated with
Invalidate(), or have its data updated withUpdateQueryData(...).
- The returned cache entry can also be invalidated with
- New overload for
UpdateQueryDatawhich takes a function of the old query data. - New
DefaultStaleTimeoption forEndpoint, which sets the stale time when no value is passed toUse. - New synchronous
Prefetch()method onEndpoint, which doesn't return a Task.
Changed
- BREAKING CHANGE: Rename
QuerySuccessContextandQueryFailureContexttoQuerySuccessEventArgsandQueryFailureEventArgs. - Various improvements to documentation and sample projects.
Fixed
- Query functions that throw
OperationCancelledExceptioninstead ofTaskCancelledExceptionwill now be caught correctly after cancelling a query.