-
Notifications
You must be signed in to change notification settings - Fork 471
For #11753 - Update compose to 1.1.1 and Kotlin to 1.6.10 #12000
Conversation
@@ -36,30 +35,25 @@ internal fun Suggestions( | |||
state = state, | |||
modifier = Modifier.testTag("mozac.awesomebar.suggestions") | |||
) { | |||
val suggestions = fetcher.state.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not having this fetcher
that would update the data to display as a property inside of LazyColumn that would also recompose when the data changes would be the most important improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I fully understand this change :). Don't need to block on it, but curious if you could share more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The update to a newer compose version definitely played a part but I would also put it on the fact that here we have a recomposition loop (not bad bad but bad enough - https://developer.android.com/jetpack/compose/phases#recomp-loop) and the fact that composable functions can run in parallel - https://developer.android.com/jetpack/compose/mental-model#parallel.
Not sure what synchronization mechanisms are used to prevent issue with running composables in parallel but just speculating that it may be possible that because fetcher.state.value
is read in Suggestions
it may happen that any change in the value will trigger:
- a recomposition of the items shown (the composables which adapts those values)
- this will trigger a recomposition of the parent -
Suggestions
Suggestions
will again read the value fromfetcher.state.value
. (We should've usedremember{}
to prevent this)- the items shouldn't recompose since the actual value didn't change but maybe it did in the meantime.
Maybe these updates happen in less than a frame and recompositions didn't have time to handle it all, maybe the states are updated and a new composition is driven by different cores which may have out of sync values.
There are many "maybe"s but by moving that code for observing state out of the composable that should display the state the code becomes cleaner, more in line with Compose's direction of passing state down to be displayed - https://developer.android.com/jetpack/compose/state and hopefully skips some recompositions or at least leads a more direct line of updates, without that loop I talked about above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just putting the do not land label on re:
This should help fix mozilla-mobile/fenix#23989 - stress tested the scenario that I found to reproduce that crash and it doesn't happen anymore but more tests are needed before landing the updates at once on all projects.
@Mugurell When you write "more tests needed" did you mean prior to landing this or are you confident already? In either case we should land this on Monday or early in the week in case those crashes do come back.
@@ -37,6 +37,7 @@ class LoginExceptionStorageTest { | |||
var instantTaskExecutorRule = InstantTaskExecutorRule() | |||
|
|||
@get:Rule | |||
@Suppress("DEPRECATION") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's throwing the "deprecation" warning here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a note in the commit message. The constructor used there will become deprecated following the room
version update. To be handled in #11765.
I didn't find a clear cause or clear steps to reproduce that crash but found a general scenario that would trigger it "most of the time" in under 5 minutes (usually <1/2/3 minutes). |
This also required updating room to >= 2.4.0. This new version adds a deprecation of the `MigrationTestHelper` api used in `LoginExceptionStorageTest` that is to be later fixed in mozilla-mobile#11765. `activity_compose` was also update to the latest stable version to ensure a better match with the latest stable version for compose. Used 1.6.10 for Kotlin although 1.6.20 is available to prevent any issues with Compose 1.1.1 reported as an error at compile time: "e: This version (1.1.1) of the Compose Compiler requires Kotlin version 1.6.10 but you appear to be using Kotlin version 1.6.20 which is not known to be compatible. Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!)."
Speculative fix for mozilla-mobile/fenix#23989.
70a8dfe
to
806f974
Compare
Tested again with this applied on latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compose changes look good to me. I did review the entire PR to be clear.
Confirmed with Christian that we can land this and keep a close eye on Sentry. |
This also required updating room to >= 2.4.0.
This new version adds a deprecation of the
MigrationTestHelper
api used inLoginExceptionStorageTest
that is to be later fixed in #11765.activity_compose
was also updated to the latest stable version to ensure abetter match with the latest stable version for compose.
Most of the changes are around supporting exhaustive
when
s for sealed classes as a new kotlin feature - https://kotlinlang.org/docs/whatsnew1530.html#exhaustive-when-statements-for-sealed-and-boolean-subjectsUpdating
kotlin-coroutines
will be a followup - #11755This should help fix mozilla-mobile/fenix#23989 - stress tested the scenario that I found to reproduce that crash and it doesn't happen anymore but more tests are needed before landing the updates at once on all projects.
Pull Request checklist
After merge