Using named routes re-render sidebar while using hardcoded links does not #2353
-
Screen.Recording.2024-08-31.at.3.43.18.PM.movFor more context: <template>
<div class="flex h-[100dvh] overflow-hidden">
<!-- Sidebar -->
<Sidebar :sidebarOpen="sidebarOpen" @close-sidebar="sidebarOpen = false" />
<!-- Content area -->
<div class="relative flex flex-col flex-1 overflow-y-auto overflow-x-hidden">
<!-- Site header -->
<Header :sidebarOpen="sidebarOpen" @toggle-sidebar="sidebarOpen = !sidebarOpen" />
<main class="grow">
<RouterView />
</main>
</div>
</div>
</template> This doesn't trigger re-render
<router-link to="/dashboard/other-settings/book-ninja-summit" custom v-slot="{ href, navigate, isExactActive }">
This does
<router-link :to="{name: 'dashboard'}" custom v-slot="{ href, navigate, isExactActive }"> |
Beta Was this translation helpful? Give feedback.
Answered by
posva
Sep 4, 2024
Replies: 1 comment
-
This happens because named locations are relative to the current location even if they don't use anything. It's used to implicitly pass params that match by name. There is a planned improvement in the future by removing this implicit behavior but since it's a breaking change, it will only happen in Router 5. What I would try to figure out is why the sidebar scroll reset, that will likely bother users |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
posva
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This happens because named locations are relative to the current location even if they don't use anything. It's used to implicitly pass params that match by name. There is a planned improvement in the future by removing this implicit behavior but since it's a breaking change, it will only happen in Router 5.
What I would try to figure out is why the sidebar scroll reset, that will likely bother users