Skip to content

"Infinite" loop in the Documentation for prefech_query #32

@TheToddmeister

Description

@TheToddmeister

Hey
Im new to leptos and i ran into this issue in the documentation at:
#https://docs.rs/leptos_query/0.5.3/src/leptos_query/create_query.rs.html#167-171

**/// If you don't need the result opt for [`fetch_query()`](Self::fetch_query)**
**/// If you don't need the result opt for [`prefetch_query()`](Self::prefetch_query)**

These two function explanations are functionally an infite loop akin to looking up Adam West in the Yellow Pages.
My assumption here is that prefetch is the intended to be used without a return value?
Apologies if this is nitpicky, but I were confused for a minute.
Full context:

/// Prefetches a query and stores it in the cache. Useful for preloading data before it is needed.
**/// If you don't need the result opt for [`fetch_query()`](Self::fetch_query)**
/// This should usually be called in a [`create_effect`](leptos::create_effect) or on an event (e.g. on:click).
pub async fn prefetch_query(&self, key: K) {
    use_query_client()
        .prefetch_query(key, self.make_fetcher())
        .await
}

/// Fetch a query and store it in cache.
/// Result can be read outside of Transition.
///
**/// If you don't need the result opt for [`prefetch_query()`](Self::prefetch_query)**
/// This should usually be called in a [`create_effect`](leptos::create_effect) or on an event (e.g. on:click).
pub async fn fetch_query(&self, key: K) -> QueryState<V> {
    use_query_client()
        .fetch_query(key, self.make_fetcher())
        .await
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions