workaround for filter + create child problems

This commit is contained in:
zadam 2020-11-29 20:55:24 +01:00
parent 2338a13749
commit 1c5425c9eb
3 changed files with 18 additions and 8 deletions

12
package-lock.json generated
View File

@ -1286,17 +1286,17 @@
} }
}, },
"async-mutex": { "async-mutex": {
"version": "0.2.4", "version": "0.2.6",
"resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.2.4.tgz", "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.2.6.tgz",
"integrity": "sha512-fcQKOXUKMQc57JlmjBCHtkKNrfGpHyR7vu18RfuLfeTAf4hK9PgOadPR5cDrBQ682zasrLUhJFe7EKAHJOduDg==", "integrity": "sha512-Hs4R+4SPgamu6rSGW8C7cV9gaWUKEHykfzCCvIRuaVv636Ju10ZdeUbvb4TBEW0INuq2DHZqXbK4Nd3yG4RaRw==",
"requires": { "requires": {
"tslib": "^2.0.0" "tslib": "^2.0.0"
}, },
"dependencies": { "dependencies": {
"tslib": { "tslib": {
"version": "2.0.0", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.0.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g==" "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
} }
} }
}, },

View File

@ -24,7 +24,7 @@
"test-all": "npm run test && npm run test-es6" "test-all": "npm run test && npm run test-es6"
}, },
"dependencies": { "dependencies": {
"async-mutex": "0.2.4", "async-mutex": "0.2.6",
"axios": "0.21.0", "axios": "0.21.0",
"better-sqlite3": "7.1.1", "better-sqlite3": "7.1.1",
"body-parser": "1.19.0", "body-parser": "1.19.0",

View File

@ -1123,6 +1123,11 @@ export default class NoteTreeWidget extends TabAwareWidget {
await newActiveNode.setFocus(true); await newActiveNode.setFocus(true);
} }
} }
if (noteIdsToReload.size > 0 || noteIdsToUpdate.size > 0) {
// workaround for https://github.com/mar10/fancytree/issues/1054
this.filterHoistedBranch();
}
} }
sortChildren(node) { sortChildren(node) {
@ -1185,7 +1190,12 @@ export default class NoteTreeWidget extends TabAwareWidget {
filterHoistedBranch() { filterHoistedBranch() {
if (this.tabContext) { if (this.tabContext) {
this.tree.filterBranches(node => node.data.noteId === this.tabContext.hoistedNoteId); if (this.tabContext.hoistedNoteId === 'root') {
this.tree.clearFilter();
}
else {
this.tree.filterBranches(node => node.data.noteId === this.tabContext.hoistedNoteId);
}
} }
} }