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
* A friendly encapsulation of the standard RTK `configureStore()` function
9
-
* to add the option to persist slices.
8
+
* Encapsulates the standard RTK `configureStore()` function to add state persistence.
10
9
*
11
-
* @param options The store configuration.
12
-
* @param applicationId The unique ID that identifies the application.
13
-
* @param storageHandler The storage handler to use to persist the data.
14
-
* @returns A promise that resolves to a configured Redux store, enhanced with persistence capabilities.
10
+
* This function creates a Redux store that automatically saves and reloads specified
11
+
* slices of the state from a given storage medium. The initial rehydration is
12
+
* handled asynchronously after the store is returned.
15
13
*
16
-
* This allows specified slices to be persisted across multiple store reloads.
14
+
* @param options - The standard RTK `ConfigureStoreOptions`.
15
+
* @param applicationId - A unique ID for the application to namespace the storage keys.
16
+
* @param storageHandler - The storage handler (e.g., `localStorage`) to use for persistence.
17
+
* @param persistenceOptions - Optional configuration for persistence behavior.
18
+
* @param persistenceOptions.rehydrationTimeout - The maximum time in milliseconds to wait for rehydration to complete before timing out. Defaults to 5000.
19
+
* @param persistenceOptions.onRehydrationStart - A callback invoked when the rehydration process begins.
20
+
* @param persistenceOptions.onRehydrationSuccess - A callback invoked when the rehydration process completes successfully.
21
+
* @param persistenceOptions.onRehydrationError - A callback invoked if an error occurs during rehydration.
22
+
* @returns A configured Redux store, enhanced with `rehydrate` and `clearPersistedState` methods.
0 commit comments