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>
|
||||
<!-- Keyed on path so same-component navigation (machine -> machine via
|
||||
a relationship link) remounts and reloads; query-only changes
|
||||
(e.g. /reports?report=x) do not remount. -->
|
||||
<router-view :key="route.path" />
|
||||
(e.g. /reports?report=x) do not remount, and the settings shell
|
||||
keys as one unit so its rail survives child navigation. -->
|
||||
<router-view :key="routeViewKey" />
|
||||
</main>
|
||||
<ToastHost />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import ToastHost from '../components/ToastHost.vue'
|
||||
import {
|
||||
@@ -100,6 +101,9 @@ import { getFacilityName, getSiteLogo, getServicenowUrls } from '../utils/siteSe
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const authStore = useAuthStore()
|
||||
const routeViewKey = computed(() =>
|
||||
route.path.startsWith('/settings') ? '/settings' : route.path
|
||||
)
|
||||
const searchQuery = ref('')
|
||||
const navItems = ref([])
|
||||
const activeNotifications = ref([])
|
||||
|
||||
Reference in New Issue
Block a user