fix(component-edit) : force reload catalog to display pre-selected slot items

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-03-16 10:32:07 +01:00
parent 271844efb1
commit 428da471d1
4 changed files with 13 additions and 13 deletions

View File

@@ -81,10 +81,10 @@ onMounted(() => {
watch(
() => props.modelValue,
(value) => {
if (typeof value === 'string') {
if (typeof value === 'string' && value) {
const exists = composantOptions.value.some((c: any) => c.id === value)
if (!exists && composantOptions.value.length === 0 && !loading.value) {
loadComposants({ itemsPerPage: 200 }).catch((error: unknown) => {
if (!exists && !loading.value) {
loadComposants({ itemsPerPage: 200, force: true }).catch((error: unknown) => {
console.error('Erreur lors du chargement des composants:', error)
})
}

View File

@@ -81,10 +81,10 @@ onMounted(() => {
watch(
() => props.modelValue,
(value) => {
if (typeof value === 'string') {
if (typeof value === 'string' && value) {
const exists = pieceOptions.value.some((piece: any) => piece.id === value)
if (!exists && pieceOptions.value.length === 0 && !loading.value) {
loadPieces({ itemsPerPage: 200 }).catch((error: unknown) => {
if (!exists && !loading.value) {
loadPieces({ itemsPerPage: 200, force: true }).catch((error: unknown) => {
console.error('Erreur lors du chargement des pièces:', error)
})
}

View File

@@ -81,10 +81,10 @@ onMounted(() => {
watch(
() => props.modelValue,
(value) => {
if (typeof value === 'string') {
if (typeof value === 'string' && value) {
const exists = productOptions.value.some((product) => product.id === value)
if (!exists && productOptions.value.length === 0 && !loading.value) {
loadProducts().catch((error) => {
if (!exists && !loading.value) {
loadProducts({ force: true }).catch((error) => {
console.error('Erreur lors du chargement des produits:', error)
})
}

View File

@@ -511,11 +511,11 @@ export function useComponentEdit(componentId: string) {
])
loading.value = false
// Load catalogs for slot selectors
// Load catalogs for slot selectors (force: true to bypass cache from list pages that load fewer items)
Promise.allSettled([
loadPieces({ itemsPerPage: 200 }),
loadProducts({ itemsPerPage: 200 }),
loadComposants({ itemsPerPage: 200 }),
loadPieces({ itemsPerPage: 200, force: true }),
loadProducts({ itemsPerPage: 200, force: true }),
loadComposants({ itemsPerPage: 200, force: true }),
]).catch(() => {})
})