You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use "Go to page B' nuxt-link to navigate to http://localhost:3000/b
On http://localhost:3000/b either use Go To External link to navigate to an external link, or navigate directly to an external link via the browser
From the external site: press the browsers Back button twice
What is expected ?
User should land on /a and the anonymous middleware for page a should execute and display:"[a] ANON MIDDLEWARE" in the console
Pressing back button two times in quick succession:
Pressing back button once to get back to page B, and then once again after page B has loaded:
What is actually happening?
If the second browser click back was executed while page B was loading the middleware for page A will not execute.
Additional comments?
I seem to only be able to reproduce this issue on slower machines. On faster machines it is near impossible for me to execute the second browser back click while page B is loading.
As stated above I am also only able to reproduce this (on slower machines) if the second browser Back button is executed before page B's mounted life cycle can run.
The text was updated successfully, but these errors were encountered:
jsonpoindexter
changed the title
Middleware(s) not executing on browser back navigation
Middleware(s) not executing on double browser back navigation
Nov 21, 2019
jsonpoindexter
changed the title
Middleware(s) not executing on double browser back navigation
Middleware(s) sometimes not executing on double browser back navigation
Nov 21, 2019
It looks like what is happening is that the server side code is executed for the first navigation back to the app (page B) and then the client side code is being executed on the second page navigation back to the app (page A) thus skipping middleware execution for page A since:
In universal mode, middlewares will be called server-side once (on the first request to the Nuxt app or when page refreshes) and client-side when navigating to further routes.
Version
v2.10.2
Reproduction link
https://github.com/jsonpoindexter/nuxt-middleware-test
Steps to reproduce
http://localhost:3000/a
http://localhost:3000/b
http://localhost:3000/b
either useGo To External
link to navigate to an external link, or navigate directly to an external link via the browserWhat is expected ?
User should land on
/a
and the anonymous middleware for pagea
should execute and display:"[a] ANON MIDDLEWARE" in the consolePressing back button two times in quick succession:
Pressing back button once to get back to page B, and then once again after page B has loaded:
What is actually happening?
If the second browser click back was executed while page B was loading the middleware for page A will not execute.
Additional comments?
I seem to only be able to reproduce this issue on slower machines. On faster machines it is near impossible for me to execute the second browser back click while page B is loading.
As stated above I am also only able to reproduce this (on slower machines) if the second browser Back button is executed before page B's mounted life cycle can run.
The text was updated successfully, but these errors were encountered: