Comparing version 0.5.4 to 0.5.5
@@ -439,2 +439,5 @@ 'use strict'; | ||
branch.leaves[id] = null; | ||
if (branch.persist) { | ||
branch.persist.store(String(id), null); | ||
} | ||
} | ||
@@ -771,7 +774,3 @@ if (branch.branches.length) { | ||
const branchLeaf = addOwnLeaf(branch, id, leaf.parent, leaf.key, leaf.depth, stamp); | ||
if (branchLeaf.keys) { | ||
branchLeaf.keys.push(...addKeys); | ||
} else { | ||
branchLeaf.keys = [ ...addKeys ]; | ||
} | ||
branchLeaf.keys = [ ...addKeys ]; | ||
keysNext = keys.filter(keyId => !branch.leaves[keyId]); | ||
@@ -833,2 +832,6 @@ } | ||
if (branch.persist) { | ||
branch.persist.remove(String(id)); | ||
} | ||
const parent = ignoreParent ? void 0 | ||
@@ -857,2 +860,6 @@ : removeFromParent(branch, leaf.parent, id, stamp, leaf.depth - 1); | ||
branch.leaves[id] = null; | ||
if (branch.persist) { | ||
branch.persist.store(String(id), null); | ||
} | ||
}; | ||
@@ -1057,14 +1064,10 @@ | ||
branch.listeners.allData['persist'] = (type, _, item) => { | ||
if (branch.leaves[item.id]) { | ||
if (type === 'remove') { | ||
persist.remove(String(item.id)); | ||
} else { | ||
persist.store( | ||
String(item.id), | ||
Object.assign( | ||
{ keyString: getString(branch.leaves[item.id].key) }, | ||
branch.leaves[item.id] | ||
) | ||
); | ||
} | ||
if (type !== 'remove' && branch.leaves[item.id]) { | ||
persist.store( | ||
String(item.id), | ||
Object.assign( | ||
{ keyString: getString(branch.leaves[item.id].key) }, | ||
branch.leaves[item.id] | ||
) | ||
); | ||
} | ||
@@ -1075,13 +1078,15 @@ }; | ||
const loadLeaf = (branch, id, leaf) => { | ||
addToStrings(leaf.key, leaf.keyString); | ||
delete leaf.keyString; | ||
if (leaf !== null) { | ||
addToStrings(leaf.key, leaf.keyString); | ||
delete leaf.keyString; | ||
if (leaf.val || leaf.rT) { | ||
const rTold = getRtFromLeaves(branch, id); | ||
if (rTold) { | ||
delete branch.rF[rTold][id]; | ||
if (leaf.val || leaf.rT) { | ||
const rTold = getRtFromLeaves(branch, id); | ||
if (rTold) { | ||
delete branch.rF[rTold][id]; | ||
} | ||
if (leaf.rT) { | ||
addReferenceFrom(branch, id, leaf.rT); | ||
} | ||
} | ||
if (leaf.rT) { | ||
addReferenceFrom(branch, id, leaf.rT); | ||
} | ||
} | ||
@@ -1088,0 +1093,0 @@ |
{ | ||
"name": "stx", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"description": "a blazing fast state manager with network sync out of the box", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
441951
6047