fix: stabilize constructeur selector ui
This commit is contained in:
@@ -81,7 +81,9 @@
|
||||
<label class="label"><span class="label-text font-medium">Constructeur</span></label>
|
||||
<ConstructeurSelect
|
||||
v-if="isEditMode"
|
||||
v-model="component.constructeurId"
|
||||
class="w-full"
|
||||
:model-value="component.constructeurId || component.constructeur?.id || null"
|
||||
@update:modelValue="handleConstructeurChange"
|
||||
/>
|
||||
<div v-else class="input input-bordered input-sm bg-base-200">
|
||||
<div class="flex flex-col">
|
||||
@@ -288,6 +290,11 @@ const documentsLoaded = ref(!!(props.component.documents && props.component.docu
|
||||
const componentDocuments = computed(() => props.component.documents || [])
|
||||
const documentIcon = (doc) => getFileIcon({ name: doc.filename || doc.name, mime: doc.mimeType })
|
||||
|
||||
const handleConstructeurChange = async (value) => {
|
||||
props.component.constructeurId = value
|
||||
await updateComponent()
|
||||
}
|
||||
|
||||
const { uploadDocuments, deleteDocument, loadDocumentsByComponent } = useDocuments()
|
||||
|
||||
watch(
|
||||
@@ -301,16 +308,6 @@ watch(
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
() => props.component.constructeurId,
|
||||
(newVal, oldVal) => {
|
||||
if (!props.isEditMode) return
|
||||
if (oldVal === undefined) return
|
||||
if (newVal !== oldVal) {
|
||||
updateComponent()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
watch(
|
||||
() => props.component.documents,
|
||||
|
||||
Reference in New Issue
Block a user