Search restarted without a text change
Opening or closing the keyboard in Hitoma Launcher’s app and widget list could reload the list and collapse an expanded widget group. On September 23, 2026, we changed the search update condition and where expansion state was stored. Operations that did not change the text were being treated as new searches.
Input fields change in more ways than text
An input field also holds the cursor, selection, and active conversion range. These can change while the text stays the same. If search needs only text, it does not need to react to every input-state change.
We keep the full input state but narrow the value sent to search to its text. This Kotlin Flow example extracts text and removes repeated values.
inputState
.map { it.text }
.distinctUntilChanged()
App updates and manual refresh remain separate conditions. An unchanged query does not imply unchanged list content.
Keep interaction state when a row disappears
A row can temporarily disappear during loading, taking state stored inside it with it. We store expansion at the list level and associate it with item identity. Apps with the same name and reordered items remain distinguishable.
Changing the search text resets expansion. A row becoming invisible and the meaning of the interaction changing are different conditions.
Code from the Fix
The following excerpts illustrate the fix; some examples omit surrounding code.
_searchQuery
.map { it.text }
.distinctUntilChanged()
Change one part of the value at a time
Move only the cursor, change only conversion state, then change text to investigate what triggers a reload. For expansion, also introduce a temporarily empty list and reordered items.
The approach extends beyond search. Extract the value an operation needs before reacting to a whole state object. Choose where to store state by how long it should remain, rather than where it appears on screen.
No comments:
Post a Comment