Episode row occasionally flips back to the download button after a download completes
Checklist
- I have used the search function for OPEN issues to see if someone else has already submitted the same bug report.
- I have also used the search function for CLOSED issues to see if the problem is already solved and just waiting to be released.
- I will describe the problem with as much detail as possible.
- If the bug only to occurs with a certain podcast, I will include the URL of that podcast.
App version
develop (6f27cef03)
Android version
Any
Device model
Any
First occurred
Still present on current develop
Steps to reproduce
- Open a feed's episode list
- Start downloading an episode and watch the list while the download finishes
Most of the time the row switches to the play button when the download completes, as expected. Occasionally it flips back to the download button and stays there, even though tapping it does nothing useful because the file is already on disk. Pull to refresh fixes the display.
What happens: onQueueChanged and onPlayerStatusChanged call loadItems(), which reads the list from the database asynchronously and then replaces the fragment's list with whatever came back. When a download completes, DBWriter posts a FeedItemEvent and the handler applies the fresh item to the list in place. But if a load was already in flight, its snapshot was taken before the download write landed, and when that older snapshot is delivered after the event it simply overwrites the list again. The stale row then stays until something else triggers a refresh.
I found this while writing instrumented tests on a fork: the download-completion row reverting was reproducible on an emulator, and the code path explains it without any timing guesswork.
Expected behaviour
The download event's update is the final state; a refresh that started earlier must not overwrite it with older data.
Current behaviour
An in-flight snapshot taken before the write is applied after the event and the row reverts.
Crash logs
None
Note: this issue was AI generated.
Source: AntennaPod/AntennaPod