Skip to content

Commit

Permalink
fix(document-driven): avoid calling middleware on hash change
Browse files Browse the repository at this point in the history
  • Loading branch information
Atinux committed Aug 18, 2022
1 parent bcf241a commit 5a64f46
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/runtime/plugins/documentDriven.ts
Expand Up @@ -249,9 +249,11 @@ export default defineNuxtPlugin((nuxt) => {
}

// Route middleware
addRouteMiddleware(async (to) => {
addRouteMiddleware(async (to, from) => {
// TODO: Remove this (https://github.com/nuxt/framework/pull/5274)
if (to.path.includes('favicon.ico')) { return }
// Avoid calling on hash change
if (process.client && to.path === from.path) { return }

const redirect = await refresh(to, false)

Expand Down

0 comments on commit 5a64f46

Please sign in to comment.