Unverified Commit c8aaa260 authored by Ahmed Awan's avatar Ahmed Awan Committed by mvdbeek
Browse files

prevent duplicates in `formattedOptions` in `FormData`

parent 3cb00da0
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -200,8 +200,14 @@ const formattedOptions = computed(() => {
        // Populate keep-options from cache
        Object.entries(keepOptions).forEach(([key, option]) => {
            if (option.value && getSourceType(option.value) === currentSource.value) {
                // check if option (with same id) is already in result, if yes replace it with keepOption
                const existingOptionIndex = result.findIndex((v) => v.value?.id === option.value?.id);
                if (existingOptionIndex >= 0) {
                    result[existingOptionIndex] = option;
                } else {
                    result.unshift(option);
                }
            }
        });
        // Sort entries by hid
        result.sort((a, b) => {