Leptos Query Versions Save

Async state management for Leptos, providing simplified data fetching, integrated reactivity, SSR support, and smart cache management.

v0.5.3

2 months ago

What's Changed: Leptos Query v0.5.3

What's Changed: Leptos Query Devtools v0.1.3

  • Fixed styling bug
  • Improved crate overview docs

Full Changelog: https://github.com/gaucho-labs/leptos-query/compare/v0.5.2...v0.5.3

v0.5.2

2 months ago

What's Changed

Devtools version updated to v0.1.1 which fixed the following:

  • Fix overflow of toolbar
  • Fix stale_time and gc_time logic (properly showing infinity)
  • Ensure that observer_count is remains positive

Full Changelog: https://github.com/nicoburniske/leptos_query/compare/v0.5.1...v0.5.2

v0.5.1

2 months ago

What's Changed

Full Changelog: https://github.com/nicoburniske/leptos_query/compare/v0.5.0...v0.5.1

v0.5.0

2 months ago

What's Changed

New Features

  • Introduce create_query to group common query types. Removes the necessity of having to supply <K,V> types to query client methods (very error prone).
  • Cache Observers leptos_query::cache_observer::CacheObserver
  • Configurable Cache-wide default options leptos_query::DefaultOptions
  • Added Devtools crate to introspect state, and interact with, queries.
  • Query Cache can be cleared QueryClient::clear()
  • Client side persisters leptos_query::query_persister::QueryPersister
    • LocalStorage impl provided leptos_query::query_persister::LocalStoragePersister
  • Add local resource option to QueryOptions (for create_local_resource)
  • Query cancellation QueryClient::cancel_query

Breaking changes

  • Renamed cache_time to gc_time (garbage collection time)

  • is_stale field removed from QueryResult

  • fetch_query and prefetch_query are now async functions for one off mutations

  • IMPORTANT Query Key types may not correspond to multiple value types anymore. A Key type may only be globally associated with a single Value type.

    • Otherwise it is very bug prone. Becomes too easy to mistakenly supply wrong types to QueryClient, and have nothing happen.

Misc changes

  • Remove signals from core entirely. "Observer" pattern is used more.
  • More efficient and reliable query eviction

Full Changelog: https://github.com/nicoburniske/leptos_query/compare/v0.4.0...v0.5.0

v0.4.0

3 months ago

What's Changed

Added support for Leptos 0.6

New Contributors

Full Changelog: https://github.com/nicoburniske/leptos_query/compare/v0.3.0...v0.4.0

v0.3.0

7 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/nicoburniske/leptos_query/compare/v0.2.3...v0.3.0

v0.2.3

9 months ago

Bug Fix

  • Fixed improper usage of create_memo that caused a BorrowError when invalidating an active query

Query Client Improvements

  • Added invalidate_query_type and invalidate_all methods
  • Removed redundant QueryClient::set_query_data_now
  • Improve ergonomics of QueryClient methods using std::borrow::Borrow
  • Add examples to docs

What's Changed

Full Changelog: https://github.com/nicoburniske/leptos_query/compare/v0.2.0...v0.2.3

v0.2.0

9 months ago

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<V> now becomes QueryResult<V, impl RefetchFn>

RefetchFn is equivalent to Fn() + Clone

  • QueryResult::refetch is now Fn() + Clone instead of SignalSetter<()>
  • QueryResult now contains a QueryState<V>
  • Removed Signal for updated_at

Misc

  • Removed QueryClient::get_query_data due to inconsistent behavior.

What's Changed

New Contributors

Full Changelog: https://github.com/nicoburniske/leptos_query/commits/v0.2.0