@exodus/atoms
Advanced tools
Comparing version 7.2.0 to 7.3.0
@@ -6,2 +6,8 @@ # Change Log | ||
## [7.3.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/atoms@7.2.0...@exodus/atoms@7.3.0) (2024-04-17) | ||
### Features | ||
- don't proxyFreeze ReadonlySet and ReadonlyMap ([#6539](https://github.com/ExodusMovement/exodus-hydra/issues/6539)) ([ed7fa30](https://github.com/ExodusMovement/exodus-hydra/commit/ed7fa30b715df0ce3a1c551f3482988dbec3ec48)) | ||
## [7.2.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/atoms@7.1.0...@exodus/atoms@7.2.0) (2024-04-16) | ||
@@ -8,0 +14,0 @@ |
import makeConcurrent from 'make-concurrent'; | ||
import proxyFreeze from 'proxy-freeze'; | ||
import { isSetter } from './utils/guards.js'; | ||
const isReadonlySetOrMap = (value) => ['[object ReadonlySet]', '[object ReadonlyMap]'].includes(Object.prototype.toString.call(value)); | ||
const freeze = (value) => (isReadonlySetOrMap(value) ? value : proxyFreeze(value)); | ||
const withChangeDetection = (listener) => { | ||
@@ -17,3 +19,3 @@ let currentValue; | ||
const enqueue = makeConcurrent((fn) => fn(), { concurrency: 1 }); | ||
const postProcessValue = (value = defaultValue) => value && typeof value === 'object' ? proxyFreeze(value) : value; | ||
const postProcessValue = (value = defaultValue) => value && typeof value === 'object' ? freeze(value) : value; | ||
const get = () => atom.get().then(postProcessValue); | ||
@@ -20,0 +22,0 @@ const observe = (listener) => { |
{ | ||
"name": "@exodus/atoms", | ||
"version": "7.2.0", | ||
"version": "7.3.0", | ||
"description": "Abstraction for encapsulating a piece of data behind a simple unified interface: get, set, observe", | ||
@@ -48,3 +48,3 @@ "type": "module", | ||
}, | ||
"gitHead": "fa602a1a0c09f5e0afe7218d05a85eb162ae84c8" | ||
"gitHead": "1a06c9388e1cb50ddcaa6dd4c92c924a48996d57" | ||
} |
62944
996