From 5e9288e9fb83d17fac903fb95da6a33032e901ed Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Sat, 2 Apr 2022 00:50:41 -0700 Subject: [PATCH] client: stop middleware from signing out on /signout pre-fetch --- client/pages/_middleware.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/pages/_middleware.tsx b/client/pages/_middleware.tsx index dc514ca5..480feb92 100644 --- a/client/pages/_middleware.tsx +++ b/client/pages/_middleware.tsx @@ -12,7 +12,7 @@ export function middleware(req: NextRequest) { // header added when next/link pre-fetches a route !req.headers.get('x-middleware-preflight') - if (pathname === '/signout') { + if (!req.headers.get('x-middleware-preflight') && pathname === '/signout') { // If you're signed in we remove the cookie and redirect to the home page // If you're not signed in we redirect to the home page if (signedIn) {