Modern Apps git

← Modern-Apps.git

files: await listing refresh after path-like rename

Commit
911f350836903d29678eccf0ec7a182d46fb756a
Author
Vayun Mathur <[email protected]>
When
2026-11-17 02:44 UTC (19 days ago)
Parents
874c611
The rename test looked the renamed item up in vm.entries immediately after the file appeared on disk; the listing flow republishes after the disk write, so under load the stale listing had no nested.md and itemOf threw NoSuchElementException.

Await the listing itself showing nested.md before the lookup. Product rename behaviour unchanged.

Verified: TZ=UTC :files:testDevUnitTest FilesViewModelTest green.

Diff

files/src/test/java/com/vayunmathur/files/platform/FilesViewModelTest.kt
diff --git a/files/src/test/java/com/vayunmathur/files/platform/FilesViewModelTest.kt b/files/src/test/java/com/vayunmathur/files/platform/FilesViewModelTest.ktindex db92584d0e..3e013c62d0 100644--- a/files/src/test/java/com/vayunmathur/files/platform/FilesViewModelTest.kt+++ b/files/src/test/java/com/vayunmathur/files/platform/FilesViewModelTest.kt@@ -220,6 +220,10 @@ class FilesViewModelTest {         assertFalse(File(base, "escaped.txt").exists(), "the new name must not escape the folder")         vm.rename(itemOf("two.md"), "sub/nested.md")         await { File(dirA, "nested.md").isFile && !File(dirA, "two.md").exists() }+        // The rename lands on disk before the listing flow republishes, so+        // wait until the listing itself shows the new name before looking+        // the item up in it (under load the stale listing has no nested.md).+        await { vm.entries.value.second.any { it.name == "nested.md" } }         assertFalse(             File(dirA, "sub/nested.md").exists(),             "the new name must not move into a subfolder",