leptos_fetch/dev_tools/
mod.rs

1/// [`QueryDevtools`] is provided to help visualize all of the inner workings of Leptos Fetch and will likely save a bunch of tedious debugging!
2///
3/// To enable, the `devtools` feature must be added, the component won't be shown or included in the binary when you build your app in release mode for performance.
4///
5/// If you need the devtools component in release mode, you can use the `devtools-always` feature instead.
6///
7/// ```bash
8/// cargo add leptos-fetch --feature devtools
9/// ```
10///
11/// ```rust,no_run
12/// use leptos::*;
13/// use leptos_fetch::{QueryClient, QueryDevtools};
14/// #[component]
15/// fn App() -> impl IntoView {
16///    let client = QueryClient::new().provide();
17///     view!{
18///         // This will render the devtools as a small widget in the bottom-right of the screen,
19///         // this will only show in development mode.
20///         <QueryDevtools client=client />
21///         // Rest of App...
22///     }
23/// }
24/// ```
25#[leptos::component]
26pub fn QueryDevtools<Codec: 'static>(
27    /// The client to monitor.
28    client: crate::QueryClient<Codec>,
29) -> impl leptos::IntoView {
30    #[cfg(any(
31        all(debug_assertions, feature = "devtools"),
32        feature = "devtools-always"
33    ))]
34    {
35        use inner::dev_tools::DevtoolsRoot;
36        use leptos::prelude::*;
37        view! { <DevtoolsRoot client=client /> }
38    }
39}
40
41#[cfg(any(
42    all(debug_assertions, feature = "devtools"),
43    feature = "devtools-always"
44))]
45mod inner;