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
and `oneCacheSelector` to ensure that all modules use the same cache and reduce the chance for cache misses.
212
212
These all have restricted APIs to reduce the chance for misconfiguration however if you require more control/customization
213
213
use [`ImmutableCache`](#immutablecache), [`FetchyeReduxProvider`](#fetchyereduxprovider) and [`makeServerFetchye`](#makeserverfetchye). Please bear in mind that this can impact modules which are do not use the same configuration.
@@ -633,13 +633,13 @@ export default BookList;
633
633
634
634
#### One App SSR
635
635
636
-
Using `makeOneServerFetchye` from `fetchye-one-app` ensures that the cache will
636
+
Using `oneFetchye` from `fetchye-one-app` ensures that the cache will
| `error?` | `Object` | An object containing an error if present. *Defaults to an `Error` object with a thrown `fetch` error. This is not for API errors (e.g. Status 500 or 400). See `data` for that* |
920
921
921
922
923
+
### oneFetchye
924
+
925
+
Call fetchye in an imperative context, such as in One App's loadModuleData, in a Redux Thunk, or in an useEffect.
| `key` | `String` or `() =>String` | `true` | A string or function returning a string that factors into cache key creation. *Defaults to URL compatible string*. |
938
+
| `options` | `ES6FetchOptions` | `false` | Options to pass through to [ES6 Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). |
939
+
| `fetcher` | `async (fetchClient:Fetch, key:String, options:Options) => ({ payload:Object, error?:Object })` | `false` | The async function that calls `fetchClient` by key and options. Returns a `payload` with outcome of `fetchClient` and an optional `error` object. |
940
+
941
+
**`onefetchye` Returns**
942
+
943
+
A promise resolving to an object with the below keys:
| `data` | `Object` | A result of a `fetchClient` query. *Defaults to returning `{ status, body, ok, headers }` from `fetchClient` response* |
948
+
| `error?` | `Object` | An object containing an error if present. *Defaults to an `Error` object with a thrown `fetch` error. This is not for API errors (e.g. Status 500 or 400). See `data` for that* |
949
+
950
+
922
951
### Providers
923
952
924
953
A Provider creates a React Context to connect all the `useFetchye` Hooks into a centrally stored cache.
0 commit comments