From 23ec39493825d027506ba1a2124c8a8bc51a9cbe Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 6 Mar 2024 13:43:21 -0400 Subject: data: inheritFromContributionPresets: logic cleanup --- .../contribution/inheritFromContributionPresets.js | 29 ++++++---------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'src/data') 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), - }, ], }); -- cgit 1.3.0-6-gf8a5