Josh Eldridge
02/07/2024, 3:17 AMcomposable
of my NavGraph, it causes my BottomNavBar to reset to the base tab/route when I rotate the device, but if I take out these arguments the rotation doesn't affect the BottomNavBar at all 🤔.
It is also affecting completely unrelated tabs and routes too, anywhere I rotate it sends me back to my home route, like it's destroying the graph state
arguments = listOf(navArgument(BuildsNavigation.ItemList.initialItemIdsArg) {
this.type = NavType.LongArrayType
this.defaultValue = LongArray(0)
}),
Josh Eldridge
02/07/2024, 3:44 AMemptyArray<Long>()
to see if maybe my usage of LongArray was causing it but it just seems to be if I assign a default value it is breaking my graph entirelyAtul Gupta
02/07/2024, 9:27 PMJosh Eldridge
02/08/2024, 1:56 AMequal
ended up not being equal for this route when some logic was comparing it, because of the referential equality, so I wonder if that's the issue. I did pull out the default array so it only uses the one referenced array across calls and that fixes it.
Thanks Atul for the comment, I don't think the lambda was the issue but specifically the defaultValue. I ended up switching to a string of items joined together after I first discovered this. But now I'm curious if we're not supposed to be using a NavType.LongArrayType
since a default value for a non-primitive breaks the graphAtul Gupta
02/08/2024, 8:10 PMlongArrayOf(0)
it creates array of primitive long(but not sure if defaultValue
will take that or not)