Tlaster / PreCompose

Compose Multiplatform Navigation && State Management

Home Page:https://tlaster.github.io/PreCompose/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Very High recomposition with Scene Block

sumit-jha-Pw opened this issue · comments

This situation is arising with Whenever we try passing arguments with path as query params
example:-

scene(OnboardingRoutes.LANDING.route) {
        OnboardingScreen(
            onclick = {
                navigator.navigate(
                    OnboardingRoutes.SCREEN2.route+"?key=value"
                )
            }
        )
    }
    scene(OnboardingRoutes.SCREEN2.route) {
        val param = it.query<String>("key")
        println("Screen 2 " + param)
        Screen2Onbaord()
    }

here Screen 2 value gets printed six times, which means it's computing the query operation that many times.
Whereas on the other hand when we don't pass any argument it works once only.

Can you check if the version 1.5.4 has less recomposition count?

Already on that version @Tlaster .

And can you check if upgrade to 1.5.7 the recomposition count remain the same?

Your 1.5.7 uses BaseActivity as ComponentActivity, and if we are using moko libraries it requires supportFragmentManager which is available with FragmentActivity as Base Activity.
so one can't upgrade to your 1.5.7, only 1.5.4 works for them.

Any workaround this would be helpful @Tlaster here.

Your 1.5.7 uses BaseActivity as ComponentActivity, and if we are using moko libraries it requires supportFragmentManager which is available with FragmentActivity as Base Activity. so one can't upgrade to your 1.5.7, only 1.5.4 works for them.

Any workaround this would be helpful @Tlaster here.

After the version 1.5.5 there's no needs to use PreComposeActivity, You can checkout the migration guide here

Thanks @Tlaster , this solved the issue . Can close this issue.

Close as fixed