@scm-manager/ui-api 3.7.2 → 3.7.4-20250125-130119

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.
package/build/index.js CHANGED
@@ -3396,13 +3396,21 @@ function useLocalStorage(key, initialValue) {
3396
3396
  return () => window.removeEventListener("storage", listener);
3397
3397
  }, [key, initialValue]);
3398
3398
  const setValue = (newValue) => {
3399
- const computedNewValue = newValue instanceof Function ? newValue(item) : newValue;
3400
- setItem(computedNewValue);
3401
- const json = JSON.stringify(computedNewValue);
3402
- localStorage.setItem(key, json);
3403
- window.dispatchEvent(
3404
- new StorageEvent("storage", { key, oldValue: item, newValue: json, storageArea: localStorage })
3405
- );
3399
+ setItem((oldValue) => {
3400
+ const computedNewValue = newValue instanceof Function ? newValue(oldValue) : newValue;
3401
+ setItem(computedNewValue);
3402
+ const json = JSON.stringify(computedNewValue);
3403
+ localStorage.setItem(key, json);
3404
+ window.dispatchEvent(
3405
+ new StorageEvent("storage", {
3406
+ key,
3407
+ oldValue: JSON.stringify(oldValue),
3408
+ newValue: json,
3409
+ storageArea: localStorage
3410
+ })
3411
+ );
3412
+ return computedNewValue;
3413
+ });
3406
3414
  };
3407
3415
  return [item, setValue];
3408
3416
  }
package/build/index.mjs CHANGED
@@ -3205,13 +3205,21 @@ function useLocalStorage(key, initialValue) {
3205
3205
  return () => window.removeEventListener("storage", listener);
3206
3206
  }, [key, initialValue]);
3207
3207
  const setValue = (newValue) => {
3208
- const computedNewValue = newValue instanceof Function ? newValue(item) : newValue;
3209
- setItem(computedNewValue);
3210
- const json = JSON.stringify(computedNewValue);
3211
- localStorage.setItem(key, json);
3212
- window.dispatchEvent(
3213
- new StorageEvent("storage", { key, oldValue: item, newValue: json, storageArea: localStorage })
3214
- );
3208
+ setItem((oldValue) => {
3209
+ const computedNewValue = newValue instanceof Function ? newValue(oldValue) : newValue;
3210
+ setItem(computedNewValue);
3211
+ const json = JSON.stringify(computedNewValue);
3212
+ localStorage.setItem(key, json);
3213
+ window.dispatchEvent(
3214
+ new StorageEvent("storage", {
3215
+ key,
3216
+ oldValue: JSON.stringify(oldValue),
3217
+ newValue: json,
3218
+ storageArea: localStorage
3219
+ })
3220
+ );
3221
+ return computedNewValue;
3222
+ });
3215
3223
  };
3216
3224
  return [item, setValue];
3217
3225
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-manager/ui-api",
3
- "version": "3.7.2",
3
+ "version": "3.7.4-20250125-130119",
4
4
  "description": "React hook api for the SCM-Manager backend",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.mjs",
@@ -26,7 +26,7 @@
26
26
  "react-i18next": "11"
27
27
  },
28
28
  "devDependencies": {
29
- "@scm-manager/ui-types": "3.7.2",
29
+ "@scm-manager/ui-types": "3.7.4-20250125-130119",
30
30
  "tsup": "^5.12.6",
31
31
  "@types/react-test-renderer": "^17.0.1",
32
32
  "@scm-manager/babel-preset": "^2.13.1",