Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions src/pages/fileBrowser/fileBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
$selectionMenuToggler.style.display = "none";
$pasteToggler.style.display = "none";
const progress = {};
let cachedDir = {};
let cachedDir = new Map();
let currentDir = {
url: null,
name: null,
Expand Down Expand Up @@ -255,8 +255,6 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
}

if (action === "reload") {
const { url } = currentDir;
if (url in cachedDir) delete cachedDir[url];
reload();
return;
}
Expand Down Expand Up @@ -731,7 +729,7 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
}
recents.removeFile(url);
openFolder.removeItem(url);
delete cachedDir[url];
cachedDir.delete(url);
}

function updateSelectionCount($count) {
Expand Down Expand Up @@ -1471,8 +1469,8 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
let list = [];
let error = false;

if (url in cachedDir) {
return cachedDir[url];
if (cachedDir.has(url)) {
return cachedDir.get(url);
} else {
if (url === "/") {
list = await listAllStorages();
Expand Down Expand Up @@ -1807,8 +1805,8 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
const $oldList = $content.get("#list");
if ($oldList) {
const { url } = currentDir;
if (url && cachedDir[url]) {
cachedDir[url].scroll = $oldList.scrollTop;
if (url && cachedDir.has(url)) {
cachedDir.get(url).scroll = $oldList.scrollTop;
}
$oldList.remove();
}
Expand All @@ -1817,13 +1815,13 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
$list.focus();

currentDir = dir;
cachedDir[dir.url] = dir;
cachedDir.set(dir.url, dir);
updatePasteToggler();
}

function reload() {
const { url, name } = currentDir;
delete cachedDir[url];
cachedDir.delete(url);
navigate(url, name);
}

Expand Down