Keep the settings rail alive across child navigation
Keying the outer router-view on route.path made every settings click remount the whole settings shell, resetting the rail scroll to the top. The key now treats /settings/* as one unit so the shell (and its scroll position) persists while child pages swap; detail-to-detail remounts elsewhere are unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -77,15 +77,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- Keyed on path so same-component navigation (machine -> machine via
|
<!-- Keyed on path so same-component navigation (machine -> machine via
|
||||||
a relationship link) remounts and reloads; query-only changes
|
a relationship link) remounts and reloads; query-only changes
|
||||||
(e.g. /reports?report=x) do not remount. -->
|
(e.g. /reports?report=x) do not remount, and the settings shell
|
||||||
<router-view :key="route.path" />
|
keys as one unit so its rail survives child navigation. -->
|
||||||
|
<router-view :key="routeViewKey" />
|
||||||
</main>
|
</main>
|
||||||
<ToastHost />
|
<ToastHost />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import ToastHost from '../components/ToastHost.vue'
|
import ToastHost from '../components/ToastHost.vue'
|
||||||
import {
|
import {
|
||||||
@@ -100,6 +101,9 @@ import { getFacilityName, getSiteLogo, getServicenowUrls } from '../utils/siteSe
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
|
const routeViewKey = computed(() =>
|
||||||
|
route.path.startsWith('/settings') ? '/settings' : route.path
|
||||||
|
)
|
||||||
const searchQuery = ref('')
|
const searchQuery = ref('')
|
||||||
const navItems = ref([])
|
const navItems = ref([])
|
||||||
const activeNotifications = ref([])
|
const activeNotifications = ref([])
|
||||||
|
|||||||
Reference in New Issue
Block a user