Simplify previous fix
This commit is contained in:
parent
c0e271d1d5
commit
879a2bbd31
|
@ -21,11 +21,10 @@ class TreeView {
|
||||||
const $jstree = this.$jstree
|
const $jstree = this.$jstree
|
||||||
|
|
||||||
$jstree.settings.core.data = (node, cb) => {
|
$jstree.settings.core.data = (node, cb) => {
|
||||||
const loadAll = this.adapter.canLoadEntireTree() &&
|
const prMode = this.store.get(STORE.PR) && repo.pullNumber
|
||||||
this.store.get(STORE.LOADALL)
|
const loadAll = this.adapter.canLoadEntireTree() && (prMode || this.store.get(STORE.LOADALL))
|
||||||
// No lazy loading in PR tree view
|
|
||||||
const isPR = this.store.get(STORE.PR) && repo.pullNumber
|
node = !loadAll && (node.id === '#' ? {path: ''} : node.original)
|
||||||
node = !loadAll && !isPR && (node.id === '#' ? {path: ''} : node.original)
|
|
||||||
|
|
||||||
this.adapter.loadCodeTree({repo, token, node}, (err, treeData) => {
|
this.adapter.loadCodeTree({repo, token, node}, (err, treeData) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -33,7 +32,7 @@ class TreeView {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
treeData = this._sort(treeData)
|
treeData = this._sort(treeData)
|
||||||
if (loadAll || isPR) {
|
if (loadAll) {
|
||||||
treeData = this._collapse(treeData)
|
treeData = this._collapse(treeData)
|
||||||
}
|
}
|
||||||
cb(treeData)
|
cb(treeData)
|
||||||
|
|
Loading…
Reference in New Issue