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:
@@ -81,10 +81,10 @@ onMounted(() => {
|
|||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
(value) => {
|
(value) => {
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string' && value) {
|
||||||
const exists = composantOptions.value.some((c: any) => c.id === value)
|
const exists = composantOptions.value.some((c: any) => c.id === value)
|
||||||
if (!exists && composantOptions.value.length === 0 && !loading.value) {
|
if (!exists && !loading.value) {
|
||||||
loadComposants({ itemsPerPage: 200 }).catch((error: unknown) => {
|
loadComposants({ itemsPerPage: 200, force: true }).catch((error: unknown) => {
|
||||||
console.error('Erreur lors du chargement des composants:', error)
|
console.error('Erreur lors du chargement des composants:', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,10 +81,10 @@ onMounted(() => {
|
|||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
(value) => {
|
(value) => {
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string' && value) {
|
||||||
const exists = pieceOptions.value.some((piece: any) => piece.id === value)
|
const exists = pieceOptions.value.some((piece: any) => piece.id === value)
|
||||||
if (!exists && pieceOptions.value.length === 0 && !loading.value) {
|
if (!exists && !loading.value) {
|
||||||
loadPieces({ itemsPerPage: 200 }).catch((error: unknown) => {
|
loadPieces({ itemsPerPage: 200, force: true }).catch((error: unknown) => {
|
||||||
console.error('Erreur lors du chargement des pièces:', error)
|
console.error('Erreur lors du chargement des pièces:', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,10 +81,10 @@ onMounted(() => {
|
|||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
(value) => {
|
(value) => {
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string' && value) {
|
||||||
const exists = productOptions.value.some((product) => product.id === value)
|
const exists = productOptions.value.some((product) => product.id === value)
|
||||||
if (!exists && productOptions.value.length === 0 && !loading.value) {
|
if (!exists && !loading.value) {
|
||||||
loadProducts().catch((error) => {
|
loadProducts({ force: true }).catch((error) => {
|
||||||
console.error('Erreur lors du chargement des produits:', error)
|
console.error('Erreur lors du chargement des produits:', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -511,11 +511,11 @@ export function useComponentEdit(componentId: string) {
|
|||||||
])
|
])
|
||||||
loading.value = false
|
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([
|
Promise.allSettled([
|
||||||
loadPieces({ itemsPerPage: 200 }),
|
loadPieces({ itemsPerPage: 200, force: true }),
|
||||||
loadProducts({ itemsPerPage: 200 }),
|
loadProducts({ itemsPerPage: 200, force: true }),
|
||||||
loadComposants({ itemsPerPage: 200 }),
|
loadComposants({ itemsPerPage: 200, force: true }),
|
||||||
]).catch(() => {})
|
]).catch(() => {})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user