https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
a

adte

10/11/2023, 1:40 AM
Question: I'm making an editor with SQLDelight and the Flow extension to get refresh support. When I make edits in the editor, I want to prevent refresh the editor itself, but still refresh other screens. How would I go about doing that? In the past I've used a boolean flag like "blockUpdate" in the control but here I'm using IO dispatchers to read/write from the db.
d

Derek Ellis

10/11/2023, 1:49 AM
If I'm understanding your goal correctly, I think you could approach it in one of two ways? 1. Use flows on your other screens, but just don't use them in the editor 2. Use takeWhile to ignore updates to the flow in your editor while you don't want it to update automatically
👍 1
a

adte

10/11/2023, 1:59 AM
1. Use flows on your other screens, but just don't use them in the editor
You're right about that, the thing I didn't mention is, potentially the data could be changed from some other window in the app or a script, and then, the editor should be refreshed. But if the change was made by the editor, then it shouldn't refresh so that i can keep the selection information, etc.
takeWhile is an interesting idea. I think the thing is, since database read/write happen asynchronously, I can't really know that it was the editor that made a given change