diff options
author | 0x85FB9C51 <77808164+0x85FB9C51@users.noreply.github.com> | 2021-07-01 17:17:41 -0400 |
---|---|---|
committer | 0x85FB9C51 <77808164+0x85FB9C51@users.noreply.github.com> | 2021-07-01 17:17:41 -0400 |
commit | 2ddb05c1cfbd146c4bd0888c3502c7ad3ab5f961 (patch) | |
tree | fbb44a2d01066a86ca6aa95b86f01b7810ce7092 /src | |
parent | be53a5a9122d0a6caa27810e34544578abb4c573 (diff) |
added bugfixes to other branches of the if-else
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/CollectionSchemaCells.tsx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index e9c5c009f..3fb9910b5 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -277,7 +277,8 @@ export class CollectionSchemaCell extends React.Component<CellProps> { inputAsString += '"'; //two options here: we can strip off outer quotes or we can figure out what's going on with the script const script = CompileScript(inputAsString, { requiredType: type, typecheck: false, editable: true, addReturn: true, params: { this: Doc.name, $r: "number", $c: "number", $: "any" } }); - script.compiled && (retVal = this.applyToDoc((inputAsString.length !== value.length || inputAsString.length - 2 !== value.length) ? this._rowDoc : this._rowDataDoc, this.props.row, this.props.col, script.run)); + const changeMade = inputAsString.length !== value.length || inputAsString.length - 2 !== value.length + script.compiled && (retVal = this.applyToDoc(changeMade ? this._rowDoc : this._rowDataDoc, this.props.row, this.props.col, script.run)); // handle numbers and expressions } else if (inputIsNum || value.startsWith("=")) { //TODO: make accept numbers @@ -290,11 +291,13 @@ export class CollectionSchemaCell extends React.Component<CellProps> { } } const script = CompileScript(inputSansCommas, { requiredType: type, typecheck: false, editable: true, addReturn: true, params: { this: Doc.name, $r: "number", $c: "number", $: "any" } }); - script.compiled && (retVal = this.applyToDoc(inputSansCommas.length + 2 !== value.length ? this._rowDoc : this._rowDataDoc, this.props.row, this.props.col, script.run)); + const changeMade = value.length !== value.length || value.length - 2 !== value.length + script.compiled && (retVal = this.applyToDoc(changeMade ? this._rowDoc : this._rowDataDoc, this.props.row, this.props.col, script.run)); // handle booleans } else if (inputIsBool) { const script = CompileScript(value, { requiredType: type, typecheck: false, editable: true, addReturn: true, params: { this: Doc.name, $r: "number", $c: "number", $: "any" } }); - script.compiled && (retVal = this.applyToDoc(value.length + 2 !== value.length ? this._rowDoc : this._rowDataDoc, this.props.row, this.props.col, script.run)); + const changeMade = value.length !== value.length || value.length - 2 !== value.length + script.compiled && (retVal = this.applyToDoc(changeMade ? this._rowDoc : this._rowDataDoc, this.props.row, this.props.col, script.run)); } } if (retVal) { |