@exodus/atoms 5.2.0 → 5.2.1
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/package.json +3 -2
- package/src/enforce-rules.js +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/atoms",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"main": "src/index.js",
|
|
5
|
+
"description": "Abstraction for encapsulating a piece of data behind a simple unified interface: get, set, observe",
|
|
5
6
|
"author": "Exodus Movement Inc.",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"test": "jest",
|
|
@@ -34,5 +35,5 @@
|
|
|
34
35
|
"eslint": "^8.33.0",
|
|
35
36
|
"jest": "^29.1.2"
|
|
36
37
|
},
|
|
37
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "3cc58449431fce7a8fa18be6d7f389727d09665b"
|
|
38
39
|
}
|
package/src/enforce-rules.js
CHANGED
|
@@ -39,7 +39,7 @@ const enforceObservableRules = ({ defaultValue, getInitialized = () => true, log
|
|
|
39
39
|
return atom.observe((value) => publishSerially(postProcessValue(value)))
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const set = async (value) => {
|
|
42
|
+
const set = makeConcurrent(async (value) => {
|
|
43
43
|
// support a function a la React's setState(oldState => newState)
|
|
44
44
|
if (typeof value === 'function') {
|
|
45
45
|
const current = getInitialized() ? await get() : defaultValue
|
|
@@ -49,7 +49,7 @@ const enforceObservableRules = ({ defaultValue, getInitialized = () => true, log
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
await atom.set(value)
|
|
52
|
-
}
|
|
52
|
+
})
|
|
53
53
|
|
|
54
54
|
return {
|
|
55
55
|
get,
|