1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

Desktop: Resolves #262: Implement "show all notes" (#2472)

* Implement "show all notes" feature.

* Ensure middleware is completely flushed and shutdown before continuing tests.
This commit is contained in:
mic704b
2020-02-22 22:25:16 +11:00
committed by GitHub
parent 0f28060795
commit fbedc6b29b
15 changed files with 344 additions and 16 deletions

View File

@@ -34,22 +34,40 @@ class FoldersScreenUtils {
}
static async refreshFolders() {
const folders = await this.allForDisplay({ includeConflictFolder: true });
FoldersScreenUtils.refreshCalls_.push(true);
try {
const folders = await this.allForDisplay({ includeConflictFolder: true });
this.dispatch({
type: 'FOLDER_UPDATE_ALL',
items: folders,
});
this.dispatch({
type: 'FOLDER_UPDATE_ALL',
items: folders,
});
} finally {
FoldersScreenUtils.refreshCalls_.pop();
}
}
static scheduleRefreshFolders() {
if (this.scheduleRefreshFoldersIID_) clearTimeout(this.scheduleRefreshFoldersIID_);
this.scheduleRefreshFoldersIID_ = setTimeout(() => {
this.scheduleRefreshFoldersIID_ = null;
this.refreshFolders();
}, 1000);
}
static async cancelTimers() {
if (this.scheduleRefreshFoldersIID_) clearTimeout(this.scheduleRefreshFoldersIID_);
return new Promise((resolve) => {
const iid = setInterval(() => {
if (!FoldersScreenUtils.refreshCalls_.length) {
clearInterval(iid);
resolve();
}
}, 100);
});
}
}
FoldersScreenUtils.refreshCalls_ = [];
module.exports = { FoldersScreenUtils };