11<template >
2- <div class =" page-editor" >
2+ <!-- TODO MIG add a skeleton loader while the page is loading. -->
3+ <div v-if =" builder && currentPage && sharedPage" class =" page-editor" >
34 <PageHeader />
45 <div class =" layout__col-2-2 page-editor__content" >
56 <div :style =" { width: `calc(100% - ${panelWidth}px)` }" >
@@ -41,7 +42,6 @@ definePageMeta({
4142
4243const mode = ' editing'
4344const route = useRoute ()
44- const router = useRouter ()
4545const { $store , $registry , $i18n } = useNuxtApp ()
4646
4747const panelWidth = ref (360 )
@@ -129,7 +129,6 @@ const currentPage = computed(() => pageData.value?.page ?? null)
129129
130130// Computed properties
131131const dataSources = computed (() => {
132- if (! currentPage .value ) return []
133132 return $store .getters [' dataSource/getPageDataSources' ](currentPage .value )
134133})
135134
@@ -139,7 +138,6 @@ const sharedPage = computed(() => {
139138})
140139
141140const sharedDataSources = computed (() => {
142- if (! sharedPage .value ) return []
143141 return $store .getters [' dataSource/getPageDataSources' ](sharedPage .value )
144142})
145143
@@ -219,19 +217,16 @@ watch(
219217
220218// Navigation guards
221219onBeforeRouteUpdate ((to , from ) => {
222- // TODO MIG Somehow this hook is called when we leave the route for another component
223- // This tests avoid navigation errors.
224- if (from .params .builderId === undefined ) {
225- return
226- }
227220 // Unselect previously selected element
228221 const currentBuilder = $store .getters [' application/get' ](
229222 parseInt (from .params .builderId )
230223 )
231- $store .dispatch (' element/select' , {
232- builder: currentBuilder,
233- element: null ,
234- })
224+ if (currentBuilder) {
225+ $store .dispatch (' element/select' , {
226+ builder: currentBuilder,
227+ element: null ,
228+ })
229+ }
235230 if (from .params .builderId !== to .params ? .builderId ) {
236231 // When we switch from one application to another we want to logoff the current user
237232 if (currentBuilder) {
0 commit comments