Skip to content

Commit 0d598ca

Browse files
authored
fix: harvester features not initialized on first page load (#1043)
Fix #1040
1 parent 1de7256 commit 0d598ca

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

components/Harvesters/DescribeHarvester.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,15 @@ function getMissingConfigs(): HarvestBackend['extra_configs'] {
361361
watchEffect(() => {
362362
// On config change:
363363
// - initialize available features
364-
form.value.features = (backendInfo.value?.features || []).reduce<Record<string, boolean>>((acc, feat) => (acc[feat.key] = form.value.features[feat.key] || feat.default, acc), {})
364+
if (backendInfo.value) {
365+
form.value.features = backendInfo.value.features.reduce<Record<string, boolean>>(
366+
(acc, feat) => {
367+
acc[feat.key] = feat.key in form.value.features ? form.value.features[feat.key] : feat.default
368+
return acc
369+
},
370+
{},
371+
)
372+
}
365373
// - remove previous configs or filters not existing anymore (the backend fails if we send some unknown filters or config)
366374
form.value.configs = form.value.configs.filter(({ key }) => !backendInfo.value || backendInfo.value.extra_configs.find(config => config.key === key))
367375
form.value.filters = form.value.filters.filter(({ key }) => !backendInfo.value || backendInfo.value.filters.find(filter => filter.key === key))

0 commit comments

Comments
 (0)