v0.2.0
Changes
New version based on introduction of QueryState<V>
enum
Fix premature Query eviction from cache
A Query will only be evicted from cache once it are no longer being used, and the specified cache_time
has elapsed since the last update. If a query gets marked for eviction, then receives an update as it's being used, it will not get evicted from cache and the timeout will restart.
New QueryState<V>
enum
QueryResult
now contains a signal for the current QueryState
. This required a lot of changes internally, but only a few for users.
Stale is intentionally not a state, and is instead a derived signal inside of QueryResult
. This distinction allows for a query to be stale, while also having a descriptive state.
Here's what it looks like:
pub enum QueryState<V> {
/// The initial state of a Query upon its creation.
Created,
/// Query is fetching for the first time.
Loading,
/// A Query is in the process of fetching, not being its first fetch.
Fetching(QueryData<V>),
/// The state indicating that a query has successfully completed a fetch operation.
Loaded(QueryData<V>),
/// The state indicating that a query has completed a fetch, but the fetched data is marked as invalid.
Invalid(QueryData<V>),
}
Refactor of QueryResult
QueryResult now becomes QueryResult<V, impl RefetchFn>
RefetchFn
is equivalent toFn() + Clone
QueryResult::refetch
is nowFn() + Clone
instead ofSignalSetter<()>
QueryResult
now contains aQueryState<V>
- Removed Signal for
updated_at
Misc
- Removed
QueryClient::get_query_data
due to inconsistent behavior.
What's Changed
- Reactive Key for use_query by @nicoburniske in #1
- Query state enum refactor + Fixing Cache Cleanup by @nicoburniske in #3
New Contributors
- @nicoburniske made their first contribution in #1
Full Changelog: https://github.com/nicoburniske/leptos_query/commits/v0.2.0