fix(compare): preserve unchecked comparison options

This commit is contained in:
zipg authored and GitHub committed 2026-08-05 09:44:58 +08:00
1 parent 0dfc6b5cd8
commit 9440835c94
2 files changed
+96 -11

No files matched your search

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { ref } from "vue";
import { useI18n } from "vue-i18n";
import { Button } from "@/components/ui/button";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
@@ -19,18 +19,10 @@ const emit = defineEmits<{
const { t } = useI18n();
// Local copy of options
// The panel is a transactional editor: it is recreated each time it opens and
// only commits its local snapshot when the user clicks Done.
const localOptions = ref<SchemaDiffCompareOptions>(normalizeSchemaDiffCompareOptions(props.options));
// Watch for external changes
watch(
() => props.options,
(newOptions) => {
localOptions.value = normalizeSchemaDiffCompareOptions(newOptions);
},
{ deep: true },
);
function isChecked(id: BooleanSchemaDiffCompareOptionKey): boolean {
return !!localOptions.value[id];
}