On the note of `StackNavigation.bringToFront(confi...
# decompose
s
On the note of
StackNavigation.bringToFront(configuration: C)
. This has been one of the few things in decompose that surprised me (in a bad way). From the name of the function I would never have guessed that it removes all items of type C. Rather, I would have expected it to look for an item equal to c and remove that. Though I see the use in having a function that clears all instances of type C. So in the interest of an intuitive API I would petition for a change of name/functionality. Maybe for uhhh v3.0? 😄
a
That's by design. bringToFront means "bring the component of the specified type to front, creating it if it doesn't exist yet, or recreating if the configuration has changed". This was added specifically for bottom bar navigation, but could be useful in other cases as well.
s
Yeah, I definitely see the reason for its existence, and I make use of it myself. It is just that the name doesn't seem to describe its effect well. Just by its name I thought "I can use this if I want to bring a configuration to the front that may already be on the stack". Particularly with the constraint of "you can't have the same configuration on the stack twice" that idea makes complete sense. But the fact that it doesn't just drop the configuration c but all configurations of type C is, in my opinion, a surprise.
a
Thanks for the feedback, I'll think about it.