middle-router icon indicating copy to clipboard operation
middle-router copied to clipboard

Don't exit route/middleware when it continues to match current/next path

Open aaronshaf opened this issue 7 years ago • 1 comments

aaronshaf avatar Oct 06 '16 16:10 aaronshaf

What is the preferred functionality here?

A) When the middleware still matches, the exiting promise given last time still won't resolve, but the middleware function is still called again.

  • You might have duplicate handlers then, since the first ones never got cleaned up.

B) When the middleware still matches, it doesn't get called again.

  • This would require caching intermediate results and only running the functions that differ. I think this is a no-go, considering the assumptions it makes about your middleware functions' behavior.

Perhaps the problem is the time gap between the exiting promise resolution and the function being called again? I'm pretty sure I can reduce that time gap, perhaps even to having the middleware called before the exiting promise resolves. Would that help the use case you were thinking of?

vanwagonet avatar Nov 27 '16 03:11 vanwagonet