aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/KeyValueBox.tsx
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2024-03-31 13:24:39 -0400
committersrichman333 <sarah_n_richman@brown.edu>2024-03-31 13:24:39 -0400
commitc254b38690e27b32d3ac6316af9bb37d6d3e86aa (patch)
tree0f94869895530d5f8b16631aa164bbcf4cd3e9d4 /src/client/views/nodes/KeyValueBox.tsx
parent4c4ab22252aba8f08d8a384e2bd0c6696db9b43b (diff)
parent1e37adacfe5b44a71ed7d7dfd785c6c2d0808eae (diff)
Merge branch 'master' into dataviz-ai-sarah
Diffstat (limited to 'src/client/views/nodes/KeyValueBox.tsx')
-rw-r--r--src/client/views/nodes/KeyValueBox.tsx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/client/views/nodes/KeyValueBox.tsx b/src/client/views/nodes/KeyValueBox.tsx
index 2bcad806f..31a2367fc 100644
--- a/src/client/views/nodes/KeyValueBox.tsx
+++ b/src/client/views/nodes/KeyValueBox.tsx
@@ -55,7 +55,7 @@ export class KeyValueBox extends ObservableReactComponent<FieldViewProps> {
@observable _splitPercentage = 50;
get fieldDocToLayout() {
- return this._props.fieldKey ? DocCast(this._props.Document[this._props.fieldKey], DocCast(this._props.Document)) : this._props.Document;
+ return DocCast(this._props.Document);
}
@action
@@ -105,17 +105,18 @@ export class KeyValueBox extends ObservableReactComponent<FieldViewProps> {
default: {
const _setCacheResult_ = (value: FieldResult) => {
field = value as Field;
- setResult?.(value);
+ if (setResult) setResult?.(value);
+ else target[key] = field;
};
const res = script.run({ this: Doc.Layout(doc), self: doc, _setCacheResult_ }, console.log);
if (!res.success) {
if (key) target[key] = script.originalScript;
return false;
}
- field === undefined && (field = res.result);
+ field === undefined && (field = res.result instanceof Array ? new List<any>(res.result) : res.result);
}
}
- if (!key) return field;
+ if (!key) return false;
if (Field.IsField(field, true) && (key !== 'proto' || field !== target)) {
target[key] = field;
return true;