undermark5
10/02/2023, 11:36 PMLaunchedEffect that manually updates the widget via update but this is almost certainly definitely not how it is supposed to be done.undermark5
10/03/2023, 12:15 AMundermark5
10/03/2023, 12:35 PMJames O'Claire
10/03/2023, 8:56 PMundermark5
10/03/2023, 10:10 PMforEach { delay250) } to the flow before collecting it and that generally seems to have solved the problem, but nothing that we can see from the documentation really gives any indication that quick successive recompositions may be ignored (though perhaps we are just missing that)Willie Koomson
10/04/2023, 4:37 PMWillie Koomson
10/04/2023, 4:40 PMprovideContent so that the widget goes from showing "stale but valid data -> fresh data" instead of "stale data -> loading state -> fresh data"Willie Koomson
10/04/2023, 4:45 PMWillie Koomson
10/04/2023, 4:47 PMLaunchedEffect to call GlanceAppWidget.update, that means your composition is still running. In that case, you should be able to update state variables to trigger recomposition instead of calling update manuallyundermark5
10/04/2023, 5:14 PMLaunchedEffect triggering), removing and adding the widget (or adding another copy of it) it would correctly show the error state. Notably this was happening after a fresh install of the app (debug build).undermark5
10/04/2023, 5:29 PMprovideContent that is the UI, and then our first compose based frame is using the fresh and valid data?undermark5
10/04/2023, 5:40 PMprovideContent so that the widget goes from showing "stale but valid data -> fresh data" instead of "stale data -> loading state -> fresh data"
To me this implies that provideGlance would be called again when the next update is triggered (assuming that provideGlance is not still running). Is that accurate?Willie Koomson
10/04/2023, 7:16 PMit would get stuck showing our loading state even though we were successfully recomposing with the error stateIs this the layout defined in
android:initialLayout in your <appwidget-provider /> info or a loading state composed by your widget?undermark5
10/04/2023, 7:21 PMundermark5
10/04/2023, 7:24 PMandroid:initialLayout though.undermark5
10/04/2023, 7:27 PMLaunchedEffectWillie Koomson
10/04/2023, 7:33 PMGlanceAppWidget tag? Also is there a sample I can try to reproduce this?undermark5
10/04/2023, 7:46 PMundermark5
10/06/2023, 11:12 PMGlanceAppWidget tag. I'll see if I can get a sample project spun up that reproduces as well, but so far I've had no luck.Willie Koomson
10/12/2023, 7:28 PMundermark5
10/12/2023, 7:43 PMforEach{ delay(250) } just before that collectLatest and the issue goes away.Willie Koomson
10/16/2023, 10:48 PMuiState flow is a member of your GlanceAppWidget class. One instance of this class can be used to compose for multiple widgets, so they will share the uiState variable. You should declare it in provideGlance instead.Willie Koomson
10/16/2023, 10:51 PMundermark5
10/17/2023, 3:13 PMprovideGlance)
1: we are using 1.0.0
2: Rotating the device has no impact, item is still stuck, I believe if we wait around long enough that the configured refresh time happens then the widget correctly updates (but we shouldn't need to wait for that as we should still be within the available window)