@exodus/atoms 7.3.1 → 7.3.2
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 +6 -0
- package/lib/enforce-rules.d.ts +2 -1
- package/lib/enforce-rules.js +3 -2
- package/lib/factories/storage.js +1 -0
- package/package.json +2 -2
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.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/atoms@7.3.1...@exodus/atoms@7.3.2) (2024-05-09)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- prevent storage atoms of flooding reads on boot ([#6877](https://github.com/ExodusMovement/exodus-hydra/issues/6877)) ([23c1e79](https://github.com/ExodusMovement/exodus-hydra/commit/23c1e798808ac7417e151e627cb8fced5ef55454))
|
|
11
|
+
|
|
6
12
|
## [7.3.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/atoms@7.3.0...@exodus/atoms@7.3.1) (2024-05-09)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/lib/enforce-rules.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Atom } from './utils/types.js';
|
|
2
2
|
type Params<T> = {
|
|
3
|
+
makeGetConcurrent?: boolean;
|
|
3
4
|
getInitialized?: () => boolean;
|
|
4
5
|
defaultValue?: T;
|
|
5
6
|
set: (value: T) => Promise<void>;
|
|
6
7
|
} & Omit<Atom<T>, 'set' | 'reset'>;
|
|
7
|
-
declare const enforceObservableRules: <T>({ defaultValue, getInitialized, ...atom }: Params<T>) => Atom<T>;
|
|
8
|
+
declare const enforceObservableRules: <T>({ defaultValue, makeGetConcurrent, getInitialized, ...atom }: Params<T>) => Atom<T>;
|
|
8
9
|
export default enforceObservableRules;
|
package/lib/enforce-rules.js
CHANGED
|
@@ -14,10 +14,11 @@ const withChangeDetection = (listener) => {
|
|
|
14
14
|
await listener(currentValue);
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
const enforceObservableRules = ({ defaultValue, getInitialized = () => true, ...atom }) => {
|
|
17
|
+
const enforceObservableRules = ({ defaultValue, makeGetConcurrent = false, getInitialized = () => true, ...atom }) => {
|
|
18
18
|
const enqueue = makeConcurrent((fn) => fn(), { concurrency: 1 });
|
|
19
19
|
const postProcessValue = (value = defaultValue) => value && typeof value === 'object' ? freeze(value) : value;
|
|
20
|
-
const
|
|
20
|
+
const _get = makeGetConcurrent ? makeConcurrent(atom.get) : atom.get;
|
|
21
|
+
const get = () => _get().then(postProcessValue);
|
|
21
22
|
const observe = (listener) => {
|
|
22
23
|
let called = false;
|
|
23
24
|
let valueEmittedFromGet;
|
package/lib/factories/storage.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/atoms",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.2",
|
|
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": "
|
|
48
|
+
"gitHead": "d826264da11cdb907877d8796d882f8e488abcea"
|
|
49
49
|
}
|