Skip to content

Commit 0739bc2

Browse files
committed
Document normalize global option
1 parent 3c685dc commit 0739bc2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/normy-react-query/README.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,23 @@ the official `QueryClient` and you can use all `react-query` features normally.
144144
- `reactQueryConfig` - this is just normal `react-query` config, which you would pass as `new QueryClient(reactQueryConfig)`,
145145
with `normy` you can do it with `createNormalizedQueryClient(reactQueryConfig)`
146146
- `normalizerConfig` - this is `normy` config, which you might need to meet requirements for data normalisation to work - see
147-
[explanation](https://github.com/klis87/normy/tree/master/#required-conditions-arrow_up) for more details.
147+
[explanation](https://github.com/klis87/normy/tree/master/#required-conditions-arrow_up) for more details. Additionally to `normy` config, you can also pass `normalize` option, which is `true` by default - if you pass `false`, nothing will be normalized unless explicitely set (see the next paragraph)
148148

149149
## Disabling of normalisation per query and mutation [:arrow_up:](#table-of-content)
150150

151151
By default all your queries and mutations will be normalized. That means that for each query there will be normalized representation
152152
of its data and for each mutation its response data will be read and all dependent normalized queries will be updated.
153153

154-
You might want to disable data normalisation per query/mutation, for example for performance reason for some extreme big queries,
154+
However, it does not always make sense to normalize all data. You might want to disable data normalisation, for example for performance reason for some extreme big queries,
155155
or just if you do not need it for a given query, for instance if a query data will be never updated.
156156

157+
Anyway, you might want to change this globally by passing `normalize` to `createNormalizedQueryClient`:
158+
159+
```js
160+
createNormalizedQueryClient(reactQueryConfig, { normalize: false });
161+
```
162+
163+
Then, you may override the global default `normalize` setting per query and mutation.
157164
For this, you can use `meta` option, for example for `useQuery`:
158165

159166
```js

0 commit comments

Comments
 (0)