@steroidsjs/core 3.0.12 → 3.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/hooks/useTree.js +8 -4
  2. package/package.json +1 -1
package/hooks/useTree.js CHANGED
@@ -145,10 +145,14 @@ function useTree(config) {
145
145
  (0, react_use_1.useUnmount)(function () {
146
146
  saveInClientStorage();
147
147
  });
148
- (0, react_use_1.useBeforeUnload)(function () {
149
- saveInClientStorage();
150
- return true;
151
- });
148
+ (0, react_1.useEffect)(function () {
149
+ if (config.saveInClientStorage) {
150
+ window.addEventListener('beforeunload', saveInClientStorage);
151
+ }
152
+ return function () {
153
+ window.removeEventListener('beforeunload', saveInClientStorage);
154
+ };
155
+ }, [config.saveInClientStorage, saveInClientStorage]);
152
156
  var onExpand = (0, react_1.useCallback)(function (e, uniqueId, item) {
153
157
  var _a;
154
158
  e.preventDefault();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "3.0.12",
3
+ "version": "3.0.13",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {