Manuel Unterhofer
05/08/2023, 7:39 AMFocusRequester
within a LaunchedEffect
but I am worried that this would not reliably happen within the same frame because the coroutine behind LaunchedEffect
might be scheduled too late?Loney Chou
05/08/2023, 8:46 AMFocusRequester
+ Modifier.focusRequester
or FocusRequesterModifierNode
(experimental), and most of the time you would use the former. A FocusRequester needs to know where it is in order to search for a focusable target, and this is done during the composition phase (when updating the modifier
of a LayoutNode
). Considering not causing any weird issue, using XxxEffect
should be the safest and fastest way, because they get executed right after the composition is ready (if I remember correctly).DisposableEffect
for it right. It gets executed on the spot, unlike LaunchedEffect
which will somehow "schedule" the execution, it depends.Manuel Unterhofer
05/08/2023, 9:25 AMDisposableEffect
has keys. That should solve it, thanks!Zach Klippenstein (he/him) [MOD]
05/15/2023, 11:19 PMLaunchedEffect
should work as well. The coroutines are scheduled at the same time as `DisposableEffect`s are ran, and so they will always be dispatched before the next frame’s input handling phase (which is the first thing the choreographer does)