nextcloud / nextcloud/android

Favorites get sometimes appended into the current view, likely race condition

Open
#10,677 6 comments 0 reactions 0 assignees View on GitHub
approved bug feature: files needs review stable-3.21
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### ⚠️ Before posting ⚠️

- [X] This is a **bug**, not a question or an enhancement.
- [X] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [X] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [X] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).

### Steps to reproduce

1. Mark a 5 folders as favorite in the web UI, make sure these are NOT in the current folder
1. Kill the app and start from scratch, just to be sure
1. Switch repeatedly between the "Favorites" section, sometimes click on a favorite folder, go back sometimes with back button, sometimes with the arrow on the top (sorry, I couldn't find accurate steps, it seems to be timing related)
1. Be unlucky :four_leaf_clover:

### Expected behaviour

The root folder list always only contains root folder entries.
The favorite section only contains one instance of the favorites.

### Actual behaviour

### Sometimes 1
I see the favorite getting appended into the root folder list and then it quickly disappears.

### Sometimes 2
Same as 1, and all the favorites stay in the root folder list, even though they don't belong here.

### Sometimes 3
I see replication of favorite entries within the favorite section
![image](https://user-images.githubusercontent.com/277525/186635642-753d16f0-4681-43a9-bf76-e5897ad0efed.png)

### Android version

12

### Device brand and model

Samsung Galaxy A52s 5G

### Stock or custom OS?

Stock

### Nextcloud android app version

3.21.0

### Nextcloud server version

24.0.4

### Using a reverse proxy?

No

### Android logs

_No response_

### Server error logs

_No response_

### Additional information

I use favorites a lot and tend to trigger that issue by chance quite often.
It's only when I purposefully want to reproduce this that it doesn't happen... :four_leaf_clover:

Considering the clues (see "Actual result") and the fact that it's timing related, it looks like maybe the favorite list is being loaded in the background (sometimes the spinner is missing btw) and when the user switches, they get appended into whatever view is currently opened.

There is likely a check in the code where such entries get quickly discarded in case they don't fit (see "Sometimes 1"), I guess that the check itself sometimes runs too early or not at all, given the symptoms.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.