Skip to content

Commit 3965a58

Browse files
authoredSep 24, 2023
Merge pull request #3466 from evertbouw/patch-1
2 parents 3dd91ca + 3d4e058 commit 3965a58

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎docs/rtk-query/usage/persistence-and-rehydration.mdx

+6
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@ export const api = createApi({
4444
baseQuery: fetchBaseQuery({ baseUrl: '/' }),
4545
// highlight-start
4646
extractRehydrationInfo(action, { reducerPath }) {
47+
// when persisting the root reducer
4748
if (action.type === REHYDRATE) {
4849
return action.payload[reducerPath]
4950
}
51+
52+
// when persisting the api reducer
53+
if (action.type === REHYDRATE && action.key === 'key used with redux-persist') {
54+
return action.payload
55+
}
5056
},
5157
// highlight-end
5258
endpoints: (build) => ({

0 commit comments

Comments
 (0)
Please sign in to comment.