-
Maybe something obvious I missed, but why do configurations have to be unique? Configurations in my mind are basically URL paths, right? So why can't the user visit the same URL more than once? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hello and thanks for the question. This is because how the API is designed, the main method for navigation is as follows: One the one hand, this gives a lot of flexibility, as you can manipulate the stack how you want. For example you may want to navigate from A <- B <- C <- D to C <- E <- A (the head of the stack is at the end). But on the other hand, the Calculating diffs requires all components to be unique, because the Additionally, configurations are used as map keys in some other places, or compared by hash code. If you have any issues due to this requirement, I will be happy to help find a solution. |
Beta Was this translation helpful? Give feedback.
-
@arkivanov Hi. There are cases where the same screen can occur multiple times in a stack. For example, imagine a social networking app. You can open a What is the best way to implement it with Decompose? The possible solution is to add some synthetic unique fields to the configurations. But it looks a little weird, isn't it? What do you think about such cases? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the use case! First of all please consider the bringToFront navigation function. So if |
Beta Was this translation helpful? Give feedback.
-
@arkivanov seems like good options. Thank you! |
Beta Was this translation helpful? Give feedback.
Hello and thanks for the question. This is because how the API is designed, the main method for navigation is as follows:
navigate(transformer: (List<C>) -> List<C>)
. So instead of direct commands likepush
orpop
, there is one single methodnavigate
.One the one hand, this gives a lot of flexibility, as you can manipulate the stack how you want. For example you may want to navigate from A <- B <- C <- D to C <- E <- A (the head of the stack is at the end).
But on the other hand, the
Router
has a requirement to destroy removed components, to create new components, and to do nothing with the components that are still in the stack. In order to achieve it, theRouter
calculates diffs between…