Skip to content

Commit

Permalink
Merge branch 'release/v1.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
rousan committed Feb 5, 2021
2 parents a27e3a6 + 981b728 commit ca2737c
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 26 deletions.
2 changes: 1 addition & 1 deletion dist/hyperdis.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/hyperdis.js.map

Large diffs are not rendered by default.

47 changes: 34 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hyperdis",
"description": "A high performance reactive state store for web apps",
"homepage": "https://github.com/chartshq/hyperdis",
"version": "1.0.1",
"version": "1.0.2",
"license": "MIT",
"main": "dist/hyperdis.js",
"author": "Charts.com <[email protected]>",
Expand Down Expand Up @@ -59,4 +59,4 @@
"lint": "eslint ./src",
"docs": "jsdoc -c ./jsdoc.conf.json"
}
}
}
12 changes: 8 additions & 4 deletions src/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default class Graph {
return eNode[`regListenerFor${fnSpec.type}`](fnSpec.fn);
}

update (...params) {
update (params) {
let changedSet,
upstreamNodes;
const
Expand All @@ -117,7 +117,9 @@ export default class Graph {
return entry[0];
});
nodes.forEach(node => node.resolve());
electricEdges.push(...flat(...nodes.map(node => node.electricEdges)));
for (let val of flat(nodes.map(node => node.electricEdges))) {
electricEdges.push(val);
}
changedSet = new ForeignSet(nodes.map(node => node.qualifiedName));

if (!this._propagate) {
Expand All @@ -129,7 +131,9 @@ export default class Graph {
upstreamNodes = getUpstreamNodes(nodes);
upstreamNodes.forEach(upstreamNode => upstreamNode.resolve());
changedSet.append(upstreamNodes.map(node => node.qualifiedName));
electricEdges.push(...flat(...upstreamNodes.map(node => node.electricEdges)));
for (let val of flat(upstreamNodes.map(node => node.electricEdges))) {
electricEdges.push(val);
}

this.__execUniqueElectricEdges(Array.from(new Set(electricEdges)), changedSet);
return this;
Expand Down Expand Up @@ -163,7 +167,7 @@ export default class Graph {
resetNodeValue (...qnames) {
const nodes = qnames.map(qname => this.qualifiedNodeMap[qname]),
args = nodes.map(node => [node, node.seed]);
this.update(...args);
this.update(args);
return this;
}

Expand Down
8 changes: 4 additions & 4 deletions src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class Model {
*/
unlock () {
this._lockFlag = false;
this.setProp(...this._reqQ);
this.setProp(this._reqQ);
this._reqQ.length = 0;
return this;
}
Expand Down Expand Up @@ -289,15 +289,15 @@ class Model {
}

if (len === 2) {
this._lockFlag ? this._reqQ.push([prop, val]) : this.setProp([prop, val]);
this._lockFlag ? this._reqQ.push([prop, val]) : this.setProp([[prop, val]]);
return this;
}

return this._graph.getNodeValue(prop);
}

// eslint-disable-next-line require-jsdoc
setProp (...props) {
setProp (props) {
// Filter out the calculated variables, so that it cant be changed from outside
// @todo if a node is not leafValue, and change is called, ignore it too
// props = props.filter(prop => !(VirtualObj.walkTill(prop[0].split('.'), this._vObj).leafValue()
Expand All @@ -307,7 +307,7 @@ class Model {
return this;
}

this._graph.update(...props.map(prop => [this._graph.getNodeFromQualifiedName(prop[0]), prop[1]]));
this._graph.update(props.map(prop => [this._graph.getNodeFromQualifiedName(prop[0]), prop[1]]));
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const
compose = fns => () => {
fns.forEach(fn => fn());
},
flat = (...params) => {
flat = (params) => {
const res = [];
params.forEach(param => res.push(...param));
return res;
Expand Down

0 comments on commit ca2737c

Please sign in to comment.