-
-
Notifications
You must be signed in to change notification settings - Fork 186
Description
I just encountered the problem while debugging Retour (distantnative/retour-for-kirby#138) that the route:after hook is a bit problematic in multilang setups.
I would argue the most common use case to hook into a successful routing.
However, the hook is actually called on every route lookup - also if the route does $this→next(), which seems counter intuitive as the first route explicitly says "not me" by calling $this→next()
https://github.com/getkirby/kirby/blob/master/src/Http/Router.php#L115-L117
My suggestion would be to move the hook call out of the loop and right before the return. To really only call the hook on routes that do not skip to the next route.
What do you think @bastianallgeier and @lukasbestle?