diff --git a/client/platform/desktop/frontend/components/Settings.vue b/client/platform/desktop/frontend/components/Settings.vue
index bc68f91a7..3e6af73a8 100644
--- a/client/platform/desktop/frontend/components/Settings.vue
+++ b/client/platform/desktop/frontend/components/Settings.vue
@@ -250,8 +250,9 @@ export default defineComponent({
Synchronize Recents
Scan project directory ({{ settings.dataPath }}) to rediscover
- datasets and update Recents page. This is useful if you've manually deleted or moved
- dataset folders around. DIVE Desktop stores annotation files, metadata, and possibly
+ datasets and update Recents. Missing or invalid project folders are removed from
+ Recents; existing access times are preserved. Useful if you've manually deleted or
+ moved dataset folders. DIVE Desktop stores annotation files, metadata, and possibly
trancoded copies of your source media here.
setRecents(d));
+ const discoveredIds = new Set(discovered.map((d) => d.id));
+
+ Object.keys(datasets.value).forEach((id) => {
+ if (!discoveredIds.has(id)) {
+ removeRecents(id);
+ }
+ });
+
+ discovered.forEach((d) => {
+ const existing = datasets.value[d.id];
+ setRecents(d, existing?.accessedAt);
+ });
}
/**
@@ -91,7 +107,6 @@ async function autoDiscover() {
* loadConfig() backend method.
*/
async function load() {
- let loaded = [];
try {
const arr = window.localStorage.getItem(RecentsKey);
if (arr) {
@@ -100,15 +115,13 @@ async function load() {
maybeArr.forEach((meta: JsonConfigCache) => (
Vue.set(datasets.value, meta.id, hydrateJsonConfigCacheValue(meta))
));
- loaded = maybeArr;
}
}
} catch (err) {
throw new Error(`could not load meta from localstorage: ${err}`);
}
- if (loaded.length === 0) {
- autoDiscover();
- }
+ /* Prune missing/dead projects and pick up new ones without wiping access times */
+ await autoDiscover();
}
function locateDuplicates(meta: JsonConfig) {