Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit 837c1fc

Browse files
authored
Merge pull request #138 from reload/redux-followup
Add support for resetting state
2 parents 074c940 + f25f09d commit 837c1fc

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/core/mount.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { withErrorBoundary } from "react-error-boundary";
55
import ErrorBoundary from "../components/alert/alert";
66
import { setToken } from "./token";
77
import Store from "../components/store";
8+
import { persistor } from "./store";
89

910
/**
1011
* We look for containers and corresponding applications.
@@ -54,12 +55,22 @@ function unmount(context) {
5455
appContainers.forEach(unMountApp);
5556
}
5657

58+
/**
59+
* Resets any stored state of all components.
60+
*
61+
* @returns {Promise<any>}
62+
*/
63+
function reset() {
64+
return persistor.purge();
65+
}
66+
5767
function init() {
5868
const initial = {
5969
apps: {},
6070
setToken,
6171
mount,
62-
unmount
72+
unmount,
73+
reset
6374
};
6475
window.ddbReact = {
6576
...(window.ddbReact || {}),

0 commit comments

Comments
 (0)