Skip to content

Commit

Permalink
only query the fs api if you navigate select a directory (OSC#2951)
Browse files Browse the repository at this point in the history
  • Loading branch information
johrstrom authored Aug 11, 2023
1 parent 3865825 commit 20ba34c
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class PathSelectorTable {
createdRow: function (row, data, _dataIndex) {
row.classList.add('clickable');
row.dataset['apiUrl'] = data.url;
row.dataset['pathType'] = data.type;
},
});
}
Expand Down Expand Up @@ -104,7 +105,17 @@ export class PathSelectorTable {
clickRow(event) {
const row = $(event.target).closest('tr').get(0);
const url = row.dataset['apiUrl'];
this.reloadTable(url);
const pathType = row.dataset['pathType'];

// only reload table for directories. and correct last visited
// if it's a file.
if(pathType == 'f') {
const currentDir = this.getLastVisited();
const fileName = url.split('/').slice(-1)[0];
this.setLastVisited(`${currentDir}/${fileName}`);
} else {
this.reloadTable(url);
}
}

clickBreadcrumb(event) {
Expand Down

0 comments on commit 20ba34c

Please sign in to comment.