@knowlearning/agents 0.5.4 → 0.5.6
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 +1 -1
- package/persistence/vuex.js +3 -3
package/package.json
CHANGED
package/persistence/vuex.js
CHANGED
|
@@ -7,10 +7,10 @@ const copy = x => JSON.parse(JSON.stringify(x))
|
|
|
7
7
|
export default async function (storeDefinition) {
|
|
8
8
|
// Set up persistance
|
|
9
9
|
const { scope } = await Agent.environment()
|
|
10
|
-
|
|
10
|
+
let state = copy(await Agent.state(scope))
|
|
11
11
|
|
|
12
12
|
const scopedPaths = getScopedPaths(storeDefinition)
|
|
13
|
-
const stateAttachedStore = await attachModuleState(
|
|
13
|
+
const stateAttachedStore = await attachModuleState(state, storeDefinition, scopedPaths)
|
|
14
14
|
const s = stateAttachedStore.state
|
|
15
15
|
const originalState = s instanceof Function ? s() : s
|
|
16
16
|
const handlePatch = patch => Agent.interact(scope, patch)
|
|
@@ -61,7 +61,7 @@ async function attachModuleState(state, module, scopedPaths, path='') {
|
|
|
61
61
|
const handlePatch = patch => Agent.interact(scope, patch)
|
|
62
62
|
const initState = await Agent.state(scope)
|
|
63
63
|
const ephemeralPaths = descendantPaths(path, scopedPaths)
|
|
64
|
-
state = MutableProxy(
|
|
64
|
+
state = MutableProxy(copy(initState), handlePatch, ephemeralPaths)
|
|
65
65
|
if (Object.keys(initState).length === 0) Object.assign(state, module.state())
|
|
66
66
|
}
|
|
67
67
|
|