@exodus/atoms 7.2.0 → 7.3.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.3.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/atoms@7.2.0...@exodus/atoms@7.3.0) (2024-04-17)
7
+
8
+ ### Features
9
+
10
+ - don't proxyFreeze ReadonlySet and ReadonlyMap ([#6539](https://github.com/ExodusMovement/exodus-hydra/issues/6539)) ([ed7fa30](https://github.com/ExodusMovement/exodus-hydra/commit/ed7fa30b715df0ce3a1c551f3482988dbec3ec48))
11
+
6
12
  ## [7.2.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/atoms@7.1.0...@exodus/atoms@7.2.0) (2024-04-16)
7
13
 
8
14
  ### Features
@@ -1,6 +1,8 @@
1
1
  import makeConcurrent from 'make-concurrent';
2
2
  import proxyFreeze from 'proxy-freeze';
3
3
  import { isSetter } from './utils/guards.js';
4
+ const isReadonlySetOrMap = (value) => ['[object ReadonlySet]', '[object ReadonlyMap]'].includes(Object.prototype.toString.call(value));
5
+ const freeze = (value) => (isReadonlySetOrMap(value) ? value : proxyFreeze(value));
4
6
  const withChangeDetection = (listener) => {
5
7
  let currentValue;
6
8
  let called = false;
@@ -14,7 +16,7 @@ const withChangeDetection = (listener) => {
14
16
  };
15
17
  const enforceObservableRules = ({ defaultValue, getInitialized = () => true, ...atom }) => {
16
18
  const enqueue = makeConcurrent((fn) => fn(), { concurrency: 1 });
17
- const postProcessValue = (value = defaultValue) => value && typeof value === 'object' ? proxyFreeze(value) : value;
19
+ const postProcessValue = (value = defaultValue) => value && typeof value === 'object' ? freeze(value) : value;
18
20
  const get = () => atom.get().then(postProcessValue);
19
21
  const observe = (listener) => {
20
22
  let called = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/atoms",
3
- "version": "7.2.0",
3
+ "version": "7.3.0",
4
4
  "description": "Abstraction for encapsulating a piece of data behind a simple unified interface: get, set, observe",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -45,5 +45,5 @@
45
45
  "@types/lodash": "^4.14.200",
46
46
  "@types/minimalistic-assert": "^1.0.2"
47
47
  },
48
- "gitHead": "fa602a1a0c09f5e0afe7218d05a85eb162ae84c8"
48
+ "gitHead": "1a06c9388e1cb50ddcaa6dd4c92c924a48996d57"
49
49
  }