Hey, I'm emitting some values via state flow, and ...
# compose-desktop
s
Hey, I'm emitting some values via state flow, and one of the windows in my multi-window app collects that state in order to show information. Whenever a new value is emitted, the window containing the composable that collects the flow takes focus. I didn't configure this behavior, and I'm struggling to find how to prevent it. When I search Google I just get a lot of results about Jetpack Compose and text fields taking focus. To be clear, I need the window to be up to date, as it will still be visible beside the focused window, I just don't want focus to change when something is emitted/collected via state flow. How can I achieve this?
z
Is there a focusable composable in the window? Can you share a minimal reproducer?
s
I'll check to make sure nothing in the window is focusable, and if that doesn't sort it out I'll create a minimal reproducer.
I couldn't reproduce it with a simple project. I suspect this may be related to Decompose at this point, as that's the major remaining difference between my real app and my repro app.
a
Please note, Decompose itself doesn't depend on Compose. There is extensions module for Compose but there is no windows API. When I worked with Compose windows on my own, I noticed some weird behavior as well. E.g. a non-modal window appeared behind the main window. And there were focus issues as well.
So, I believe it should be reproducible without Decompose as well, if you replace
Value<ChildStack<>>
with
State<List<>>
and just update the stack manually.
s
Hi, just to follow up on this, I tried removing Decompose from my app, and I can confirm that the weird focus issue still occurs. I may continue with the small test app I built to see what other difference is causing this.