Commit 659d508
fix(search): use editingQuery instead of presentationFlow in startSea… (#2942)
fix(search): use editingQuery instead of presentationFlow in startSearch fixes #2914
presentationFlow is collected asynchronously from queryFlow. When a
history item is clicked, setQuery() and startSearch() run synchronously
on the main thread with no coroutine dispatch in between, so
presentationFlow.value is always stale at the time startSearch() reads
it. This causes startSearch to pass an empty string to
SearchPageState.startSearch(), which then overwrites queryFlow back to
empty and calls searchState.clear(), making results disappear.
editingQuery is a synchronous mutableStateOf written by setQuery(), so
it always reflects the correct value at call time.1 parent 0497dc3 commit 659d508
1 file changed
Lines changed: 1 addition & 1 deletion
File tree
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
0 commit comments