Fixed
Status Update
Comments
jb...@google.com <jb...@google.com> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
[Deleted User] <[Deleted User]> #3
yea i'll take it.
[Deleted User] <[Deleted User]> #4
Thanks for the detailed analysis. This may not be an issue anymore since we've started using Main.immediate there but I' not sure; I'll try to create a test case.
ap...@google.com <ap...@google.com> #5
just emitting same live data reproduces the issue.
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
Description
Artifact used: androidx.navigation:navigation-fragment-ktx:2.3.4
Version used: 2.3.4
Theme used: N/A
Devices/Android versions reproduced on: Any
Problem
We have the following navigation graph:
Here are declared two deep links patterns:
myapp://profiles/{userId}/
myapp://profiles/{userId}/details/
But the second deep link will never be handled because these deep links are "equal" for navigation when it tries to find the best matching deep link. In this case, NavGraph will always use first matching NavDestination (profileFragment).
For example link
myapp://profiles/u2/details/
will be handled asmyapp://profils/{userId}/
whereuserId = u2/details
.There is a workaround - remove ending slash in second pattern to make patterns tails not matching:
myapp://profiles/{userId}/
myapp://profiles/{userId}/details
It works but it is not obvious.
Purposed solution
Make arguments to not include
/
character.In resulting regexp:
^\Qmyapp://profiles/\E(.+?)\Q/\E($|(\?(.)*))
Replace:
(.+?)
With:
([^/]+?)
If this solution is right, I can create pull request on GitHub.