Fix issue with lazy loading and PR view (#435)
This commit is contained in:
parent
56948ba9a3
commit
63f57adead
|
@ -23,7 +23,9 @@ class TreeView {
|
||||||
$jstree.settings.core.data = (node, cb) => {
|
$jstree.settings.core.data = (node, cb) => {
|
||||||
const loadAll = this.adapter.canLoadEntireTree() &&
|
const loadAll = this.adapter.canLoadEntireTree() &&
|
||||||
this.store.get(STORE.LOADALL)
|
this.store.get(STORE.LOADALL)
|
||||||
node = !loadAll && (node.id === '#' ? {path: ''} : node.original)
|
// No lazy loading in PR tree view
|
||||||
|
const isPR = this.store.get(STORE.PR) && repo.pullNumber
|
||||||
|
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) {
|
||||||
|
@ -31,7 +33,7 @@ class TreeView {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
treeData = this._sort(treeData)
|
treeData = this._sort(treeData)
|
||||||
if (loadAll) {
|
if (loadAll || isPR) {
|
||||||
treeData = this._collapse(treeData)
|
treeData = this._collapse(treeData)
|
||||||
}
|
}
|
||||||
cb(treeData)
|
cb(treeData)
|
||||||
|
|
Loading…
Reference in New Issue