From 08b656a047cd9fd5b7291a28880375bd97f10350 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 26 Feb 2024 19:21:25 +0000 Subject: [PATCH] fix(kit): don't warn if middleware is added twice --- packages/kit/src/pages.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/kit/src/pages.ts b/packages/kit/src/pages.ts index 9820fe64ff..3e36eb2c03 100644 --- a/packages/kit/src/pages.ts +++ b/packages/kit/src/pages.ts @@ -51,6 +51,7 @@ export function addRouteMiddleware (input: NuxtMiddleware | NuxtMiddleware[], op for (const middleware of middlewares) { const find = app.middleware.findIndex(item => item.name === middleware.name) if (find >= 0) { + if (app.middleware[find].path === middleware.path) { continue } if (options.override === true) { app.middleware[find] = middleware } else {