Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scenes freezing when quickly switching routes with transitions #267

Open
StarsEnd33A2D17 opened this issue Feb 10, 2024 · 11 comments
Open

Comments

@StarsEnd33A2D17
Copy link

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.

@Tlaster
Copy link
Owner

Tlaster commented Feb 11, 2024

Hi, can you check if the latest commit(ce4f316) of compose-1.6 branch is working for you, it's working in my testing.

@StarsEnd33A2D17
Copy link
Author

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:

e.mp4

@Tlaster
Copy link
Owner

Tlaster commented Feb 12, 2024

The current implementation requires the transition to be fully played, so this will require some internal reworking.

@Matcha-xiaobin
Copy link

@Tlaster 我也出现了这样的问题,且我用的是1.6.0-rc02

我的需求是,先跳转到页面A,然后退出页面A时,继续跳转到页面B
大概像这样:

scope.launch {
    navigator.navigateForResult("pageA")
    navigator.navigate("pageB")
}

目前的情况是,可以正确跳转到pageB,但是过渡动画会消失,并且pageB的viewModel中会请求接口获取数据,但

viewModelScope.launch {
    //在这里面执行了网络请求
}

中的任何代码都不会执行。

@Matcha-xiaobin
Copy link

@Tlaster 我也出现了这样的问题,且我用的是1.6.0-rc02

我的需求是,先跳转到页面A,然后退出页面A时,继续跳转到页面B 大概像这样:

scope.launch {
    navigator.navigateForResult("pageA")
    navigator.navigate("pageB")
}

目前的情况是,可以正确跳转到pageB,但是过渡动画会消失,并且pageB的viewModel中会请求接口获取数据,但

viewModelScope.launch {
    //在这里面执行了网络请求
}

中的任何代码都不会执行。

经过测试,如果在两次跳转中间增加一个延迟,目前大概延迟500ms后,可以正常运行

@Tlaster
Copy link
Owner

Tlaster commented Mar 14, 2024

@Matcha-xiaobin 你说的viewModelScope.launch中的代码不会执行的问题我这里无法复现,你能提供一个sample吗?

@Matcha-xiaobin
Copy link

@Tlaster
demo.zip
这里是能复现的demo

QQ20240314-184315-HD.mp4

image
正常情况下,应该是 显示 launch 执行了

@Tlaster
Copy link
Owner

Tlaster commented Mar 14, 2024

@Matcha-xiaobin 麻烦传一个git repo,文件下载提示有病毒

@Matcha-xiaobin
Copy link

@Matcha-xiaobin 麻烦传一个git repo,文件下载提示有病毒

https://github.com/Matcha-xiaobin/precompose_bug_sample

用的Mac OS自带的 压缩功能压缩的,居然会爆毒,挺离谱。

@Matcha-xiaobin
Copy link

@Tlaster 我上传到git的代码,已经是加了delay了
image
实测低于这个351就会不行

@Tlaster
Copy link
Owner

Tlaster commented Mar 14, 2024

测试在 313ce55 commit之后会被修复,下一个版本(1.6.0-rc03)会包含这个修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants