diff --git a/packages/ui/src/components/titre.tsx b/packages/ui/src/components/titre.tsx index 03355672b726a0c225a07f267ce8de0042da74dd..05badb3cf843a41085a4dab1b472db715f58208d 100644 --- a/packages/ui/src/components/titre.tsx +++ b/packages/ui/src/components/titre.tsx @@ -165,7 +165,9 @@ export const PureTitre = defineComponent<Props>(props => { let demarcheSlug = props.currentDemarcheSlug - if ( + if (isNullOrUndefinedOrEmpty(demarcheSlug) && 'erreur' in phases.value) { + demarcheSlug = phases.value.demarches[0].slug + } else if ( (isNullOrUndefinedOrEmpty(demarcheSlug) || isNullOrUndefined(data.demarches.find(({ slug }) => slug === props.currentDemarcheSlug))) && !('erreur' in phases.value) && phases.value.length > 0 @@ -195,8 +197,10 @@ export const PureTitre = defineComponent<Props>(props => { watch( () => props.titreIdOrSlug, - async () => { + async (newValue, oldValue) => { + console.log('PLOP', props.titreIdOrSlug, newValue, oldValue) if (titreData.value.status !== 'LOADED' || (titreData.value.value.id !== props.titreIdOrSlug && titreData.value.value.slug !== props.titreIdOrSlug)) { + console.log('Changement de titre') await updateTitre(props.titreIdOrSlug) } }