Scenes freezing when quickly switching routes with transitions
The issue of scenes freezing when quickly switching routes still persists in version 1.6.0-beta02, possibly due to animation-related issues.
Example:
LaunchedEffect(Unit){
coroutineScope.launch {
for (i in 0 until 10){
println(i)
navigator.navigate("/edit")
delay(200)
navigator.navigate("/home")
delay(200)
}
}
}
When using with the default animation, after 1 to 3 transitions, it will stop navigating and remain frozen indefinitely, while all interactions except routing work normally, and any route changes will not affect the actual content.
After modifying the transitions:
navTransition = NavTransition(
createTransition = EnterTransition.None,
destroyTransition = ExitTransition.None,
pauseTransition = ExitTransition.None,
resumeTransition = EnterTransition.None,
)
Then it works great.
Hi, can you check if the latest commit(https://github.com/Tlaster/PreCompose/pull/251/commits/ce4f31697c7bedd3cbae5d6969625b749a9e1876) of compose-1.6 branch is working for you, it's working in my testing.
It works fine, thanks :) Also, I noticed that the current pattern is that you can't navigate when transitioning, is it possible to consider interrupting the transition animation to ensure that the last target is displayed? Example:
https://github.com/Tlaster/PreCompose/assets/53161829/b7a35111-45c9-4e33-8e51-57c6ee762b6f
The current implementation requires the transition to be fully played, so this will require some internal reworking.
@Tlaster 我也出现了这样的问题,且我用的是1.6.0-rc02
我的需求是,先跳转到页面A,然后退出页面A时,继续跳转到页面B 大概像这样:
scope.launch {
navigator.navigateForResult("pageA")
navigator.navigate("pageB")
}
目前的情况是,可以正确跳转到pageB,但是过渡动画会消失,并且pageB的viewModel中会请求接口获取数据,但
viewModelScope.launch {
//在这里面执行了网络请求
}
中的任何代码都不会执行。
@Tlaster 我也出现了这样的问题,且我用的是1.6.0-rc02
我的需求是,先跳转到页面A,然后退出页面A时,继续跳转到页面B 大概像这样:
scope.launch { navigator.navigateForResult("pageA") navigator.navigate("pageB") }目前的情况是,可以正确跳转到pageB,但是过渡动画会消失,并且pageB的viewModel中会请求接口获取数据,但
viewModelScope.launch { //在这里面执行了网络请求 }中的任何代码都不会执行。
经过测试,如果在两次跳转中间增加一个延迟,目前大概延迟500ms后,可以正常运行
@Matcha-xiaobin 你说的viewModelScope.launch中的代码不会执行的问题我这里无法复现,你能提供一个sample吗?
@Tlaster demo.zip 这里是能复现的demo
https://github.com/Tlaster/PreCompose/assets/5775066/03350bff-558a-40f3-b2d6-d67c2ec48a5d
正常情况下,应该是 显示 launch 执行了
@Matcha-xiaobin 麻烦传一个git repo,文件下载提示有病毒
@Matcha-xiaobin 麻烦传一个git repo,文件下载提示有病毒
https://github.com/Matcha-xiaobin/precompose_bug_sample
用的Mac OS自带的 压缩功能压缩的,居然会爆毒,挺离谱。
@Tlaster 我上传到git的代码,已经是加了delay了
实测低于这个351就会不行
测试在 https://github.com/Tlaster/PreCompose/pull/251/commits/313ce550c19ef3b4c264404864086820c7fd2805 commit之后会被修复,下一个版本(1.6.0-rc03)会包含这个修复