Don't reload already loaded disk (#174)

This commit is contained in:
Will Scullin 2023-01-22 18:31:35 -08:00 committed by GitHub
parent 9173bff1ba
commit d042a5b319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -46,6 +46,7 @@ let lastFrames = 0;
let lastRenderedFrames = 0; let lastRenderedFrames = 0;
let hashtag = document.location.hash; let hashtag = document.location.hash;
let oldHashFiles: string[] = [];
const options = new Options(); const options = new Options();
const optionsModal = new OptionsModal(options); const optionsModal = new OptionsModal(options);
@ -748,6 +749,9 @@ function processHash(hash: string) {
break; break;
} }
const file = files[idx]; const file = files[idx];
if (file === oldHashFiles[idx]) {
continue;
}
if (file.indexOf('://') > 0) { if (file.indexOf('://') > 0) {
const parts = file.split('.'); const parts = file.split('.');
const ext = parts[parts.length - 1].toLowerCase(); const ext = parts[parts.length - 1].toLowerCase();
@ -760,6 +764,7 @@ function processHash(hash: string) {
loadAjax(drive, 'json/disks/' + file + '.json'); loadAjax(drive, 'json/disks/' + file + '.json');
} }
} }
oldHashFiles = files;
} }
export function updateUI() { export function updateUI() {