-
Notifications
You must be signed in to change notification settings - Fork 28
Description
The current version of event.redirect() only allows to change (once) the final committed URL in an intercepted navigation. In SPA routers, navigation guards can redirect multiple times 1. Each redirection goes through navigation guards and can be redirected again. It's up to the developer to ensure no infinite loops (the router can help detect such cases during development).
If event.redirect() only allows to change the URL before it is committed, it would not allow routers to intercept redirections created by users and force them to only use router redirections (inside navigation guards) so that the router can create a consistent experience. This is the current situation with the History API, the router has to take over and this limits users to not use the History API directly. In practice this affects any plugin that interacts with History API because it needs to be specific to a framework router. It also affects micro frontends in general because they struggle to coordinate different framework routers (they have to pause them based on the page).
Another possible solution is to treat new redirections as a full new navigation2, but this would still mean to discourage users from using event.redirect().