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
The first parameter can be `undefined` if no additional properties are needed.
309
+
277
310
### Selector Functions
278
311
279
312
The entity adapter will contain a `getSelectors()` function that returns a set of selectors that know how to read the contents of an entity state object:
As of RTK 2.1, you can define a "pre-typed" version of `createDraftSafeSelector` that can have the type for `state` built in. This lets you set up those types once, so you don't have to repeat them each time you call `createDraftSafeSelector`.
95
+
96
+
```ts no-transpile
97
+
const createTypedDraftSafeSelector =
98
+
createDraftSafeSelector.withTypes<RootState>()
99
+
```
100
+
101
+
Importandusethepre-typed`createTypedDraftSafeSelector`function, and it will automatically know that the `state` argument is of type `RootState`.
102
+
103
+
:::warning Known Limitations
104
+
Currently this approach only works if input selectors are provided as a single array.
105
+
106
+
If you pass the input selectors as separate inline arguments, the parameter types of the result function will not be inferred. As a workaround you can either
107
+
108
+
1. Wrap your input selectors in a single array
109
+
2. You can annotate the parameter types of the result function:
If you inject an endpoint that already exists and don't explicitly specify `overrideExisting: true`, the endpoint will not be overridden. In development mode, you will get a warning about this.
59
+
If you inject an endpoint that already exists and don't explicitly specify `overrideExisting: true`, the endpoint
60
+
will not be overridden. In development mode, you will get a warning about this if `overrideExisting` is set to `false`,
Copy file name to clipboardExpand all lines: docs/usage/nextjs.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -380,7 +380,7 @@ It is worth noting that initializing the store with a `useEffect` would not work
380
380
381
381
### Caching
382
382
383
-
The App Router has four seperate caches including `fetch` request and route caches. The most likely cache to cause issues is the route cache. If you have an application that accepts login you may have routes (e.g. the home route, `/`) that render different data based on the user you will need to disable the route cache by using the [`dynamic` export from the route handler](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic):
383
+
The App Router has four separate caches including `fetch` request and route caches. The most likely cache to cause issues is the route cache. If you have an application that accepts login you may have routes (e.g. the home route, `/`) that render different data based on the user you will need to disable the route cache by using the [`dynamic` export from the route handler](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamic):
0 commit comments