proxy-state-tree
Advanced tools
Comparing version 1.0.0-1532860086530 to 1.0.0-1533059066486
@@ -89,6 +89,6 @@ import proxify, { IS_PROXY, STATUS } from './proxify'; | ||
clearPathsTracking(index) { | ||
if (index !== this.paths.length - 1) { | ||
throw new Error('Nested path tracking requires you to stop the nested path tracker before the outer'); | ||
const pathSet = this.paths.splice(index, 1, null)[0]; | ||
while (this.paths[this.paths.length - 1] === null) { | ||
this.paths.pop(); | ||
} | ||
const pathSet = this.paths.pop(); | ||
if (!this.paths.length) { | ||
@@ -95,0 +95,0 @@ this.status = STATUS.IDLE; |
@@ -144,10 +144,2 @@ import ProxyStateTree, { IS_PROXY } from './'; | ||
}); | ||
test('should throw when stopping outer nested tracking before inner', () => { | ||
const tree = new ProxyStateTree({}); | ||
const trackIdA = tree.startPathsTracking(); | ||
tree.startPathsTracking(); | ||
expect(() => { | ||
tree.clearPathsTracking(trackIdA); | ||
}).toThrow(); | ||
}); | ||
test('should correctly keep track of changing indexes', () => { | ||
@@ -154,0 +146,0 @@ expect.assertions(4); |
@@ -92,6 +92,6 @@ "use strict"; | ||
clearPathsTracking(index) { | ||
if (index !== this.paths.length - 1) { | ||
throw new Error('Nested path tracking requires you to stop the nested path tracker before the outer'); | ||
const pathSet = this.paths.splice(index, 1, null)[0]; | ||
while (this.paths[this.paths.length - 1] === null) { | ||
this.paths.pop(); | ||
} | ||
const pathSet = this.paths.pop(); | ||
if (!this.paths.length) { | ||
@@ -98,0 +98,0 @@ this.status = proxify_1.STATUS.IDLE; |
@@ -146,10 +146,2 @@ "use strict"; | ||
}); | ||
test('should throw when stopping outer nested tracking before inner', () => { | ||
const tree = new _1.default({}); | ||
const trackIdA = tree.startPathsTracking(); | ||
tree.startPathsTracking(); | ||
expect(() => { | ||
tree.clearPathsTracking(trackIdA); | ||
}).toThrow(); | ||
}); | ||
test('should correctly keep track of changing indexes', () => { | ||
@@ -156,0 +148,0 @@ expect.assertions(4); |
{ | ||
"name": "proxy-state-tree", | ||
"version": "1.0.0-1532860086530", | ||
"version": "1.0.0-1533059066486", | ||
"description": "An implementation of the Mobx/Vue state tracking approach, for library authors", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
214139
2158