csells / go_router

The purpose of the go_router for Flutter is to use declarative routes to reduce complexity, regardless of the platform you're targeting (mobile, web, desktop), handling deep linking from Android, iOS and the web while still allowing an easy-to-use developer experience.
https://gorouter.dev
441 stars 97 forks source link

Go method does not push to new route #282

Closed lucasdidur closed 2 years ago

lucasdidur commented 2 years ago

I have a route something like this

/prova/:idProva/questao/:ordem

So when I use context.go("/prova/123/questao/1") and then try to go to question 2 context.go("/prova/123/questao/2") the page does not update with new data, but shows on the console that is goin to the route "(GoRouter) going to /prova/123/questao/2".

But when I use context.push, works normaly.

csells commented 2 years ago

What do your routes look like? What is "normal" behavior to you?

lucasdidur commented 2 years ago

I think they should be like pushReplacement flutter behavior. Always rebuild the page, if params change.

csells commented 2 years ago

Can you post a minimal repro that I can test against?

iAmTosuj commented 2 years ago

I have the same problem. The widget's constructor is called, but the build method does not work.

I use a bloc. If I create a bloc instance in the constructor method and pass it to the blocProvider, then after updating the page, a new bloc will be created in the constructor, but the previous blocProvider with the old bloc will remain in the widget tree.

I fixed this when I added a key for blocProvider. But maybe you know the solution better?

I will be able to show an example tomorrow.

csells commented 2 years ago

following up here: https://github.com/csells/go_router/discussions/304