Is there a length limit for navigation routes? Saw...
# compose
a
Is there a length limit for navigation routes? Saw an old thread but seems to be about a different issue. We’re sending a form input as query input which can take up to 1000 characters. The destination cannot be found if the argument is too long it seems.
i
There is no limit
If your 'query input' contains special characters, you'd need to
Uri.encode
it
2
a
Yeah, we do encode it. Let me double check the value. Edit: I’m seeing only percents and numbers. Trying to binary search if there is a specific set of characters which breaks the navigation destination matching
Soo... Turns out it's the same double decoding root cause that I raised for a different issue.
r
let me guess, some of your arguments are not mandatory arguments right Allan?
I actually have opened a change in the Androix repo (I was not sure if how exactly was the best way to open an issue with a suggestion fix, so I did that 😅 ) where I explain that non mandatory arguments are being decoded twice. Your fix for now is probably to also encode twice all non mandatory arguments. The mandatory arguments, you must only encode once
and sorry if there is a more correct way to do that 😅
a
I had raised it last month but for a different issue. https://issuetracker.google.com/issues/210711399
Yeah optional args, the bug in the code is pretty clear. Actually I don't encode twice because it will break once they fix it. I manually do the decoding instead from the route which is also included as an argument.
r
I see. Yeah you could also just remove the second encode call just before updating the nav lib to the one with the fix. That's what Im doing in my navigation library. (If you're curious: https://github.com/raamcosta/compose-destinations)
a
Wow. Cool lib.
👍 1
r
Thanks 😊 If you can, give it a try and give me feedback!
👌 1