Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Infinite" loop in the Documentation for prefech_query #32

Open
TheToddmeister opened this issue Mar 26, 2024 · 0 comments
Open

"Infinite" loop in the Documentation for prefech_query #32

TheToddmeister opened this issue Mar 26, 2024 · 0 comments

Comments

@TheToddmeister
Copy link

TheToddmeister commented Mar 26, 2024

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant