diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-03-06 13:43:21 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-12 17:26:34 -0300 |
commit | d5e79dc9330ad5a52503b27e4b6688239a97c2ac (patch) | |
tree | cab3e8473d245ba0f60d9c6ebb529bbacf6e084a | |
parent | 61a666d547b25581f52bc8f5976419e8ce3658bd (diff) |
data: inheritFromContributionPresets: logic cleanup
-rw-r--r-- | src/data/composite/things/contribution/inheritFromContributionPresets.js | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/data/composite/things/contribution/inheritFromContributionPresets.js b/src/data/composite/things/contribution/inheritFromContributionPresets.js index 72642957..82425b9c 100644 --- a/src/data/composite/things/contribution/inheritFromContributionPresets.js +++ b/src/data/composite/things/contribution/inheritFromContributionPresets.js @@ -34,7 +34,7 @@ export default templateCompositeFrom({ compute: (continuation, { ['#values']: values, }) => continuation({ - ['#presetIndex']: + ['#index']: values.findIndex(value => value !== undefined && value !== null), @@ -42,35 +42,20 @@ export default templateCompositeFrom({ }, raiseOutputWithoutDependency({ - dependency: '#presetIndex', + dependency: '#index', mode: input.value('index'), }), { - dependencies: ['#presets', '#presetIndex'], + dependencies: ['#values', '#index'], compute: (continuation, { - ['#presets']: presets, - ['#presetIndex']: presetIndex, + ['#values']: values, + ['#index']: index, }) => continuation({ - ['#preset']: - presets[presetIndex], + ['#value']: + values[index], }), }, - - withPropertyFromObject({ - object: '#preset', - property: input('property'), - }), - - // Can't use exposeDependency here since it doesn't compose, and so looks - // unfit to serve as the composition's base - even though we'll have raised - // out of this composition in the relevant cases already! - { - dependencies: ['#value'], - compute: (continuation, { - ['#value']: value, - }) => continuation.exit(value), - }, ], }); |