You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-19Lines changed: 10 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ If you do not install it, your package manager will warn you, and stac-react wil
35
35
36
36
stac-react's hooks must be used inside children of a React context that provides access to the stac-react's core functionality.
37
37
38
-
To get started, initialize `StacApiProvider` with the base URL of the STAC catalog. `StacApiProvider` automatically sets up a [TanStack Query](https://tanstack.com/query/latest/docs/framework/react/overview) QueryClientProvider for you if one doesn't already exist in the component tree.
38
+
To get started, initialize `StacApiProvider` with the base URL of the STAC catalog. `StacApiProvider` automatically sets up a [TanStack Query](https://tanstack.com/query/latest/docs/framework/react/overview) QueryClientProvider for you, so you do not need to wrap your app with QueryClientProvider yourself.
39
39
40
40
```jsx
41
41
import { StacApiProvider } from'stac-react';
@@ -47,26 +47,19 @@ function StacApp() {
47
47
}
48
48
```
49
49
50
-
If you want to customize the QueryClient configuration (e.g., for custom caching behavior, retry logic, or global settings), wrap `StacApiProvider` with your own `QueryClientProvider`:
50
+
If you want to provide your own custom QueryClient (for advanced caching or devtools), you can pass it as a prop:
Copy file name to clipboardExpand all lines: docs/react-query-setup.md
+8-23Lines changed: 8 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,45 +8,30 @@ stac-react relies on [TanStack Query](https://tanstack.com/query/latest/docs/fra
8
8
- Ensures your app and stac-react share the same QueryClient instance.
9
9
- Follows best practices for React libraries that integrate with popular frameworks.
10
10
11
-
## QueryClient Management
11
+
stac-react manages the QueryClient for you by default, but you can provide your own for advanced use cases.
12
12
13
-
By default, `StacApiProvider` automatically creates and manages a QueryClient for you if one doesn't already exist in the component tree. This means you can use stac-react without any additional setup:
13
+
**Important:** If your app uses multiple providers that require a TanStack QueryClient (such as `QueryClientProvider` and `StacApiProvider`), always use the same single QueryClient instance for all providers. This ensures that queries, mutations, and cache are shared across your app and prevents cache fragmentation or duplicate network requests.
If you need custom QueryClient configuration (e.g., custom caching behavior, retry logic, or global settings), wrap `StacApiProvider` with your own `QueryClientProvider`:
0 commit comments