Commit 75247c1
fix: prevent skipped update in StateFlow
- use collected emission `it` instead of `StateFlow.value` so lastValue tracks only what was actually processed
When performing manual deduplication inside a collect block, reading StateFlow.value instead of the emitted value (it) allows the tracking variable to "race ahead" of the collector. If multiple updates occur rapidly (e.g., while the UI is in the background), the tracking variable may be updated to the latest value while processing an intermediate emission. This causes the collector to incorrectly drop the subsequent final emission as a duplicate.1 parent aecdb30 commit 75247c1
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
| 90 | + | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
0 commit comments