Closed walsha2 closed 3 months ago
@walsha2 can you test if the linked pr correctly resolves the issue for you? (You can set the branch using ref
for an overridden git dependency)
@schultek just tested - works exactly as expected on the branch. Nice job. Redirects are getting triggered anytime the router is rebuilt.
Description
https://pub.dev/documentation/go_router/latest/topics/Redirection-topic.html
Per the go router documentation above, the following is an example and an excerpt:
There are two types of redirection:
Example
Take the following example. The
routerProvider
is listening forauthStateProvider
changes. All of this triggers correctly - when the auth state changes the router is rebuilt. However, upon entering theRouter
constructor, theredirect
method is NOT called the first time around. I would expect that since this is a top level redirect, this would happen before any navigation to see if the router needs to redirect due to the new state.The same code/logic in a flutter app using
go_router
would first try to resolve the redirect on any rebuild (in this case to check for relevant state changes).Maybe this was missed in the implementation port?
TLDR, the router is not resolving the redirects first when it is constructing the router. In turn, any actions that need to be taken are not getting triggered. This is making any sort of auth very messy and awkward to implement.
Configuration
Actually overriding all of these and using the latest
main
branch as of a6fbb30d95362723304cded037eb6f22212110bfRelated Issue
None of the redirects are actually changing the URL path in the address bar. I would expect that they would?