Skip to content

Commit 089e819

Browse files
committed
fix(Reducer): Fix bug where the state was overwritten each time the Reducer was called
1 parent 57ef866 commit 089e819

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

nodes/Reducer/Reducer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ module.exports = function(RED) {
5656
"const newState = reduce(substate, action);"+
5757
"msg.substateName = \"" + this.substateName + "\";"+
5858
"msg.substate = newState;"+
59+
60+
"global.state = Object.assign({},"+
61+
"global.state,"+
62+
"{" + this.substateName + ": newState}"+
63+
");"+
5964
"return msg;";
6065

6166
var functionText = "var results = null;"+

0 commit comments

Comments
 (0)