fix draggable instructions, kind of

This commit is contained in:
Michael Genson 2025-06-02 15:51:57 +00:00
commit d09dc2b740

View file

@ -137,7 +137,7 @@
:name="!drag ? 'flip-list' : ''" :name="!drag ? 'flip-list' : ''"
> >
<div <div
v-for="(step, index) in modelValue" v-for="(step, index) in instructionList"
:key="step.id!" :key="step.id!"
class="list-group-item" class="list-group-item"
> >
@ -499,10 +499,23 @@ export default defineNuxtComponent({
showTitleEditor.value = temp; showTitleEditor.value = temp;
} }
const instructionList = computed({ const instructionList = ref<RecipeStep[]>([...props.modelValue]);
get: () => props.modelValue,
set: (value: RecipeStep[]) => context.emit("update:modelValue", value), watch(
}); () => props.modelValue,
(newVal) => {
instructionList.value = [...newVal];
},
{ deep: true }
);
watch(
instructionList,
(newVal) => {
context.emit("update:modelValue", [...newVal]);
},
{ deep: true }
);
// =============================================================== // ===============================================================
// Ingredient Linker // Ingredient Linker