Empty Folder Content
- 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. Open root directory
2. Create a folder from web and add some file in it
3. Open same folder from app
4. Empty folder will be shown, however file must be visible.
5. This is not happening all the time and hard to reproduce.
### Steps to reproduce
1. Have a large number of images in nested directories
2. Perform a fresh installation of the app
3. Open the Media tab
4. Navigate back to All Files
5. Observe the database using App Inspection: files that previously had a valid parent ID are set to `0` after visiting the Media tab
### Expected behaviour
Folder contents should be displayed correctly.
### Actual behaviour
Sometimes folder contents looks empty.
### Android version
11
### Device brand and model
Emulator
### Stock or custom OS?
Stock
### Nextcloud android app version
3.34.0
### Nextcloud server version
32
### Additional information
`MetadataWorker` and normal folder navigation triggers `RefreshFolderOperation.java` in this class, we check `eTag` and update content of the folder. `synchronizeData(List folderAndFiles)` responsible for the updating logic.
However, in some cases child file saved into the DB but parent ID of it becomes 0 thus it is causing connection lost between child file and parent dir.
This happens because files are saved before their parent directories, causing their `parentId` to be set to 0.
**Why files are saved before their parent?**
Because `saveFile` and `saveFolder` operations can be triggered from certain places like:
Shared root, Favorites root, and the Media tab display files in a flat hierarchy, which can cause files to be updated before their parent directories. Since the `eTag` is updated in this state, subsequent refresh attempts do not restore the parent–child relationship, making a manual pull-to-refresh necessary.
Contributor guide
Assessment
This issue has not been assessed yet.