From 3646ea8c06d1d9985c2dcb58291e0b1d4ec5863e Mon Sep 17 00:00:00 2001 From: Bernd de Kruik Date: Mon, 14 Apr 2025 17:20:12 +0200 Subject: [PATCH] ensures that if deleted folders remain child of a not deleted folder in the future it will still be found by recusively going over all folders and sub folder --- devbox.lock | 542 ++++++++++++++++++ .../utils/getCanBeCollapsedFolderIds.ts | 20 +- 2 files changed, 556 insertions(+), 6 deletions(-) create mode 100644 devbox.lock diff --git a/devbox.lock b/devbox.lock new file mode 100644 index 0000000000..3089ae88ca --- /dev/null +++ b/devbox.lock @@ -0,0 +1,542 @@ +{ + "lockfile_version": "1", + "packages": { + "bat@latest": { + "last_modified": "2025-03-11T17:52:14Z", + "resolved": "github:NixOS/nixpkgs/0d534853a55b5d02a4ababa1d71921ce8f0aee4c#bat", + "source": "devbox-search", + "version": "0.25.0", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/ai2vv20xlpmnn5q7f01pw9nyna7104bl-bat-0.25.0", + "default": true + } + ], + "store_path": "/nix/store/ai2vv20xlpmnn5q7f01pw9nyna7104bl-bat-0.25.0" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/ypvcjk8hznpb56azpjd6jm8a9jv7fp7g-bat-0.25.0", + "default": true + } + ], + "store_path": "/nix/store/ypvcjk8hznpb56azpjd6jm8a9jv7fp7g-bat-0.25.0" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/yixxzkspjsfrh88nykmzy9vfg6zcwjqc-bat-0.25.0", + "default": true + } + ], + "store_path": "/nix/store/yixxzkspjsfrh88nykmzy9vfg6zcwjqc-bat-0.25.0" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/vf5hbnpkw8yy7q56kba8hl9cm25143cq-bat-0.25.0", + "default": true + } + ], + "store_path": "/nix/store/vf5hbnpkw8yy7q56kba8hl9cm25143cq-bat-0.25.0" + } + } + }, + "cairo.dev": { + "resolved": "github:NixOS/nixpkgs/2bfc080955153be0be56724be6fa5477b4eefabb?narHash=sha256-y7Hg5lwWhEOgflEHRfzSH96BOt26LaYfrYWzZ%2BVoVdg%3D#cairo.dev", + "source": "nixpkg" + }, + "electron@latest": { + "last_modified": "2025-03-25T17:32:05Z", + "resolved": "github:NixOS/nixpkgs/25d1b84f5c90632a623c48d83a2faf156451e6b1#electron", + "source": "devbox-search", + "version": "34.3.3", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/pdl6qys632vfbzxbh7a4lapx2badjjjn-electron-34.3.3", + "default": true + } + ], + "store_path": "/nix/store/pdl6qys632vfbzxbh7a4lapx2badjjjn-electron-34.3.3" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/3sjms3ra7rbjwvp962grnmmhjzqiqsf3-electron-34.3.3", + "default": true + } + ], + "store_path": "/nix/store/3sjms3ra7rbjwvp962grnmmhjzqiqsf3-electron-34.3.3" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/41n8dahfwm1dyprd330mp8gs30kqb75d-electron-34.3.3", + "default": true + } + ], + "store_path": "/nix/store/41n8dahfwm1dyprd330mp8gs30kqb75d-electron-34.3.3" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/zpy1ywgxhbjlm04bcpgxws8xwfq7vzxz-electron-34.3.3", + "default": true + } + ], + "store_path": "/nix/store/zpy1ywgxhbjlm04bcpgxws8xwfq7vzxz-electron-34.3.3" + } + } + }, + "giflib@latest": { + "last_modified": "2025-03-11T17:52:14Z", + "resolved": "github:NixOS/nixpkgs/0d534853a55b5d02a4ababa1d71921ce8f0aee4c#giflib", + "source": "devbox-search", + "version": "5.2.2", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/9gpq3dzc31sf3v120g7shbmkp1gsjgmv-giflib-5.2.2", + "default": true + } + ], + "store_path": "/nix/store/9gpq3dzc31sf3v120g7shbmkp1gsjgmv-giflib-5.2.2" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/a2avv7a4pfi916m08xv5014rpx1n0dnr-giflib-5.2.2", + "default": true + } + ], + "store_path": "/nix/store/a2avv7a4pfi916m08xv5014rpx1n0dnr-giflib-5.2.2" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/wgavxf568qzr5yj17bq988zphl2bjydr-giflib-5.2.2", + "default": true + } + ], + "store_path": "/nix/store/wgavxf568qzr5yj17bq988zphl2bjydr-giflib-5.2.2" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/1qgg81mfb3l8vm8s240rbiyzisv7y21m-giflib-5.2.2", + "default": true + } + ], + "store_path": "/nix/store/1qgg81mfb3l8vm8s240rbiyzisv7y21m-giflib-5.2.2" + } + } + }, + "git@latest": { + "last_modified": "2025-03-27T11:50:31Z", + "resolved": "github:NixOS/nixpkgs/6c5963357f3c1c840201eda129a99d455074db04#git", + "source": "devbox-search", + "version": "2.48.1", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/b3sci30zzzlj3rzj1y89cijnd6zcwapk-git-2.48.1", + "default": true + }, + { + "name": "doc", + "path": "/nix/store/086knqdw7fjgzczp0i6nad95s2v6jbya-git-2.48.1-doc" + } + ], + "store_path": "/nix/store/b3sci30zzzlj3rzj1y89cijnd6zcwapk-git-2.48.1" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/pck1dr5jxrd5b8nmfasbn13z422jhcfm-git-2.48.1", + "default": true + }, + { + "name": "debug", + "path": "/nix/store/xqqsvzlilh843rm6knykyng81apapr33-git-2.48.1-debug" + }, + { + "name": "doc", + "path": "/nix/store/485b32ys0s2dvjfisn7405ildmpqvfzk-git-2.48.1-doc" + } + ], + "store_path": "/nix/store/pck1dr5jxrd5b8nmfasbn13z422jhcfm-git-2.48.1" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/9qjzgsf9mvdp6sfd7xyzhgrahl2qhhp6-git-2.48.1", + "default": true + }, + { + "name": "doc", + "path": "/nix/store/cgv7qa0ix059ma9a0qac0bywfvl3k7k2-git-2.48.1-doc" + } + ], + "store_path": "/nix/store/9qjzgsf9mvdp6sfd7xyzhgrahl2qhhp6-git-2.48.1" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/lqx2rv26sdndpa2vyy2vxsahj03km69z-git-2.48.1", + "default": true + }, + { + "name": "doc", + "path": "/nix/store/hjczhs1dm3hzij7mx5c91rkzqvkb89av-git-2.48.1-doc" + }, + { + "name": "debug", + "path": "/nix/store/bk8xndavdnc2qgyvc6hcc8h29lk9jzqb-git-2.48.1-debug" + } + ], + "store_path": "/nix/store/lqx2rv26sdndpa2vyy2vxsahj03km69z-git-2.48.1" + } + } + }, + "github:NixOS/nixpkgs/nixpkgs-unstable": { + "resolved": "github:NixOS/nixpkgs/2bfc080955153be0be56724be6fa5477b4eefabb?lastModified=1743689281&narHash=sha256-y7Hg5lwWhEOgflEHRfzSH96BOt26LaYfrYWzZ%2BVoVdg%3D" + }, + "nodejs@latest": { + "last_modified": "2025-03-16T16:17:41Z", + "plugin_version": "0.0.2", + "resolved": "github:NixOS/nixpkgs/8f76cf16b17c51ae0cc8e55488069593f6dab645#nodejs_23", + "source": "devbox-search", + "version": "23.10.0", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/dihlffh62qmgzsrxq1igwxicdyr3fn8a-nodejs-23.10.0", + "default": true + }, + { + "name": "libv8", + "path": "/nix/store/ks94i4365833bykrzg3d3mqxnciygyrn-nodejs-23.10.0-libv8" + } + ], + "store_path": "/nix/store/dihlffh62qmgzsrxq1igwxicdyr3fn8a-nodejs-23.10.0" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/m7j1lf8a4z5bfla1m78pa3y12888hl7b-nodejs-23.10.0", + "default": true + }, + { + "name": "libv8", + "path": "/nix/store/kfvlfxx83n2w2fyb8hiz4p4dc165r035-nodejs-23.10.0-libv8" + } + ], + "store_path": "/nix/store/m7j1lf8a4z5bfla1m78pa3y12888hl7b-nodejs-23.10.0" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/nj0d1lc4nanqj7v4ibcgd26m3p5yfb0h-nodejs-23.10.0", + "default": true + }, + { + "name": "libv8", + "path": "/nix/store/k5rvmvqyibamfxa7cfzjfd5ldmi38kf3-nodejs-23.10.0-libv8" + } + ], + "store_path": "/nix/store/nj0d1lc4nanqj7v4ibcgd26m3p5yfb0h-nodejs-23.10.0" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/m7imcmwi4hschl257dzc33gxciqlf4bm-nodejs-23.10.0", + "default": true + }, + { + "name": "libv8", + "path": "/nix/store/wy7ysxmd2ygdc5zpbhf9ripwgvvvnwsd-nodejs-23.10.0-libv8" + } + ], + "store_path": "/nix/store/m7imcmwi4hschl257dzc33gxciqlf4bm-nodejs-23.10.0" + } + } + }, + "pango.dev": { + "resolved": "github:NixOS/nixpkgs/2bfc080955153be0be56724be6fa5477b4eefabb?narHash=sha256-y7Hg5lwWhEOgflEHRfzSH96BOt26LaYfrYWzZ%2BVoVdg%3D#pango.dev", + "source": "nixpkg" + }, + "pixman@latest": { + "last_modified": "2025-03-23T05:31:05Z", + "resolved": "github:NixOS/nixpkgs/dd613136ee91f67e5dba3f3f41ac99ae89c5406b#pixman", + "source": "devbox-search", + "version": "0.44.2", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/6rss4lfylr3jlw1n00rxi6d7v346qvnm-pixman-0.44.2", + "default": true + } + ], + "store_path": "/nix/store/6rss4lfylr3jlw1n00rxi6d7v346qvnm-pixman-0.44.2" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/ji4j86d3qyhihbknjbi3b6agimph1yig-pixman-0.44.2", + "default": true + }, + { + "name": "debug", + "path": "/nix/store/nadzsvbiif42h74p846kaw1ml42bniyr-pixman-0.44.2-debug" + } + ], + "store_path": "/nix/store/ji4j86d3qyhihbknjbi3b6agimph1yig-pixman-0.44.2" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/86p7a0492n4g3s7p5bzn4pv9fak4jj8y-pixman-0.44.2", + "default": true + } + ], + "store_path": "/nix/store/86p7a0492n4g3s7p5bzn4pv9fak4jj8y-pixman-0.44.2" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/cdzad6l9xgbf5gkhn1si3c1g11427ivl-pixman-0.44.2", + "default": true + }, + { + "name": "debug", + "path": "/nix/store/iwgajli3p1krs1051qbvjbbj3b3rwdp3-pixman-0.44.2-debug" + } + ], + "store_path": "/nix/store/cdzad6l9xgbf5gkhn1si3c1g11427ivl-pixman-0.44.2" + } + } + }, + "pkg-config@latest": { + "last_modified": "2025-03-11T17:52:14Z", + "resolved": "github:NixOS/nixpkgs/0d534853a55b5d02a4ababa1d71921ce8f0aee4c#pkg-config", + "source": "devbox-search", + "version": "0.29.2", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/ncw1xgww5br70kxchcnlg7mbsgwgba50-pkg-config-wrapper-0.29.2", + "default": true + }, + { + "name": "man", + "path": "/nix/store/dbixvi2qm6jkx34w3x7n0l1kcb87rycd-pkg-config-wrapper-0.29.2-man", + "default": true + }, + { + "name": "doc", + "path": "/nix/store/j6r8mz0894cm0mqfaj0jsy20ywfskphg-pkg-config-wrapper-0.29.2-doc" + } + ], + "store_path": "/nix/store/ncw1xgww5br70kxchcnlg7mbsgwgba50-pkg-config-wrapper-0.29.2" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/n6aa34qwpvhc5w85gbl1188df2fzdby4-pkg-config-wrapper-0.29.2", + "default": true + }, + { + "name": "man", + "path": "/nix/store/f5saffqd1hcwgzra27nfi2crxscd1v3b-pkg-config-wrapper-0.29.2-man", + "default": true + }, + { + "name": "doc", + "path": "/nix/store/xakcakpxizmyymgc7lf2g8bfy52fipj0-pkg-config-wrapper-0.29.2-doc" + } + ], + "store_path": "/nix/store/n6aa34qwpvhc5w85gbl1188df2fzdby4-pkg-config-wrapper-0.29.2" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/vhm1xwz33swh2f92slw2f82s5fnmsrjg-pkg-config-wrapper-0.29.2", + "default": true + }, + { + "name": "man", + "path": "/nix/store/m6k07pppjhjz33ixg85zpcscybb10kb7-pkg-config-wrapper-0.29.2-man", + "default": true + }, + { + "name": "doc", + "path": "/nix/store/jhwihmfdg3ynhvj97pi21m7qlh7rvy3q-pkg-config-wrapper-0.29.2-doc" + } + ], + "store_path": "/nix/store/vhm1xwz33swh2f92slw2f82s5fnmsrjg-pkg-config-wrapper-0.29.2" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/8cczxvv6hpngc9mxal0wx0lzny4vjp4n-pkg-config-wrapper-0.29.2", + "default": true + }, + { + "name": "man", + "path": "/nix/store/zyklfbaq17vlkzcwdz0q24ri64ll7bsk-pkg-config-wrapper-0.29.2-man", + "default": true + }, + { + "name": "doc", + "path": "/nix/store/rbgabndl0w2115v7704ijjdjgy83x9jl-pkg-config-wrapper-0.29.2-doc" + } + ], + "store_path": "/nix/store/8cczxvv6hpngc9mxal0wx0lzny4vjp4n-pkg-config-wrapper-0.29.2" + } + } + }, + "python@latest": { + "last_modified": "2025-03-23T05:31:05Z", + "plugin_version": "0.0.4", + "resolved": "github:NixOS/nixpkgs/dd613136ee91f67e5dba3f3f41ac99ae89c5406b#python313", + "source": "devbox-search", + "version": "3.13.2", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/c8k24sfwckindjhdxak6z3dhn8w4anx2-python3-3.13.2", + "default": true + } + ], + "store_path": "/nix/store/c8k24sfwckindjhdxak6z3dhn8w4anx2-python3-3.13.2" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/jsqky488530ax8hdaz5ckldxq9y6qr3k-python3-3.13.2", + "default": true + }, + { + "name": "debug", + "path": "/nix/store/fwwjmw2yddxxm6aj51r16v0ffp77zvk1-python3-3.13.2-debug" + } + ], + "store_path": "/nix/store/jsqky488530ax8hdaz5ckldxq9y6qr3k-python3-3.13.2" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/wjxlppca1s14xzw5iz608qpywyl5mcdw-python3-3.13.2", + "default": true + } + ], + "store_path": "/nix/store/wjxlppca1s14xzw5iz608qpywyl5mcdw-python3-3.13.2" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/njpnqszjaj6k38cp4466ygn74n392xy1-python3-3.13.2", + "default": true + }, + { + "name": "debug", + "path": "/nix/store/ixcc4jnj3byz0hg943wadfy1phxkmmgg-python3-3.13.2-debug" + } + ], + "store_path": "/nix/store/njpnqszjaj6k38cp4466ygn74n392xy1-python3-3.13.2" + } + } + }, + "yarn@latest": { + "last_modified": "2025-03-23T05:31:05Z", + "resolved": "github:NixOS/nixpkgs/dd613136ee91f67e5dba3f3f41ac99ae89c5406b#yarn", + "source": "devbox-search", + "version": "1.22.22", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/bgyc68xwc81pcwkcfn9n9zngs794y826-yarn-1.22.22", + "default": true + } + ], + "store_path": "/nix/store/bgyc68xwc81pcwkcfn9n9zngs794y826-yarn-1.22.22" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/sikfg44rhj0rs8r1c13p8wyckhbqgfl2-yarn-1.22.22", + "default": true + } + ], + "store_path": "/nix/store/sikfg44rhj0rs8r1c13p8wyckhbqgfl2-yarn-1.22.22" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/2li1br96rd013mimbvnsf81fk564jx0v-yarn-1.22.22", + "default": true + } + ], + "store_path": "/nix/store/2li1br96rd013mimbvnsf81fk564jx0v-yarn-1.22.22" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/sfh8adsjz44xyismwlzamq25k6lk9igl-yarn-1.22.22", + "default": true + } + ], + "store_path": "/nix/store/sfh8adsjz44xyismwlzamq25k6lk9igl-yarn-1.22.22" + } + } + } + } +} diff --git a/packages/lib/models/utils/getCanBeCollapsedFolderIds.ts b/packages/lib/models/utils/getCanBeCollapsedFolderIds.ts index 89c7a56362..d958e03430 100644 --- a/packages/lib/models/utils/getCanBeCollapsedFolderIds.ts +++ b/packages/lib/models/utils/getCanBeCollapsedFolderIds.ts @@ -16,19 +16,27 @@ export default (folders: FolderEntity[]) => { } }; - // Future proofing: if TrashFolder is already in canBeCollapsedIds do not add it again. - if (!(getTrashFolderId() in canBeCollapsedIds)) { + processTree(tree); - // Currently only deleted folders result in a collapsable Trash + // Logic to determine whether trash should be included in canBeCollapsedIds + // Loops over all folders recursively in case in the future a deleted folder remains child of a not deleted folder (and hence there is no deleted folder in 'tree'). + const isTrashCollapsable = (folders: FolderEntityWithChildren[]) => { for (const folder of folders) { if (folder.deleted_time) { canBeCollapsedIds.push(getTrashFolderId()); - break; + return; + } + + if (folder.children.length) { + isTrashCollapsable(folder.children); } } - } + }; - processTree(tree); + // Future proofing: if TrashFolder is already in canBeCollapsedIds do not add it again. + if (!(getTrashFolderId() in canBeCollapsedIds)) { + isTrashCollapsable(tree); + } return canBeCollapsedIds; };