stinsen icon indicating copy to clipboard operation
stinsen copied to clipboard

Make a `RouterStore` per `NavigationCoordinatable`

Open YuantongL opened this issue 2 years ago • 1 comments

I have a use case that I have a 3 tabs, they each holds a NavigationCoordinatable. Each tab can navigates to some screens, and there are shared screens between tabs.

I made 1 NavigationCoordinatable type for both 3 tabs as the screen routes are pretty much the same.

Now within each tab, if I reference the coordiantor.route using @EnvironmentObject, everything's fine. However, when use RouterStore, since it's shared one, the router object I get is incorrect (becasue I have 3 same ones).

I suggest RouterStore should propage the same as a @EnvironmentObject

YuantongL avatar Sep 18 '21 04:09 YuantongL

Yes, I agree. RouterStore should work the same way as EnvironmentObject. RouterStore is a bit tricky, but I'll take a look at this use case and see if it is possible to fix. But as you say, EnvironmentObject is a workaround, or passing the NavigationCoordinatable also works well.

rundfunk47 avatar Sep 18 '21 20:09 rundfunk47