reactbook icon indicating copy to clipboard operation
reactbook copied to clipboard

Story log in Excel does not record the first change

Open dmitry-weirdo opened this issue 8 years ago • 0 comments

Since a strange ternary expression does not save the first "newState" value, the first is not saved to __log variable.

The fix may be as follows:

		, _logSetState: function(newState) {
			if ( this._log.length === 0 ) { // log first state
				let firstStateClone = this.state;
				this._log.push(firstStateClone);
			}

                        // always log newState
			let stateClone = JSON.parse( JSON.stringify(newState) );
			this._log.push(stateClone);

			this.setState(newState);
		}

dmitry-weirdo avatar Sep 12 '17 00:09 dmitry-weirdo