diff options
| author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-05-05 18:26:50 -0400 |
|---|---|---|
| committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-05-05 18:26:50 -0400 |
| commit | 2a9db784a6e3492a8f7d8ce9a745b4f1a0494241 (patch) | |
| tree | c3a6c50857c3349462e525eec10fb26088292071 /src/client/views/nodes/KeyValueBox.tsx | |
| parent | f706f70451525d4d0716c631cece9d78d76b3bfd (diff) | |
| parent | 2caf7b7bb80b663b6ba585f88cdbd2d725f8505e (diff) | |
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into nathan-starter
Diffstat (limited to 'src/client/views/nodes/KeyValueBox.tsx')
| -rw-r--r-- | src/client/views/nodes/KeyValueBox.tsx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/views/nodes/KeyValueBox.tsx b/src/client/views/nodes/KeyValueBox.tsx index d85432631..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,14 +105,15 @@ 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 false; |
