summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-05-04 14:37:45 +0200
committerGitHub <noreply@github.com>2017-05-04 14:37:45 +0200
commitb66dfa909b9a8ebcf62489e71d4eca02e2a7c698 (patch)
treef8e4f8b802586d13b0acc30143adc5dafdc948b8
parentea2a7d5b0af0007c4110927e05ac3285d27570dc (diff)
parent8d66e325a9375dc06c8105a30e795965e1b73773 (diff)
downloadnextcloud-server-b66dfa909b9a8ebcf62489e71d4eca02e2a7c698.tar.gz
nextcloud-server-b66dfa909b9a8ebcf62489e71d4eca02e2a7c698.zip
Merge pull request #4693 from nextcloud/fix_4644
Do not reload the filelist on first open
-rw-r--r--apps/files/js/filelist.js11
-rw-r--r--apps/files/tests/js/filelistSpec.js6
2 files changed, 16 insertions, 1 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index db85caf65fa..187ede8c0bd 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -92,6 +92,12 @@
initialized: false,
/**
+ * Wheater the file list was already shown once
+ * @type boolean
+ */
+ shown: false,
+
+ /**
* Number of files per page
*
* @return {int} page size
@@ -557,7 +563,10 @@
* Event handler when leaving previously hidden state
*/
_onShow: function(e) {
- this.reload();
+ if (this.shown) {
+ this.reload();
+ }
+ this.shown = true;
},
/**
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index 934aa054fb6..6b403e7fa85 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -1509,6 +1509,12 @@ describe('OCA.Files.FileList tests', function() {
});
it('reloads the list when leaving hidden state', function() {
var reloadStub = sinon.stub(fileList, 'reload');
+
+ // First show should not trigger
+ $('#app-content-files').trigger(new $.Event('show'));
+ expect(reloadStub.calledOnce).toEqual(false);
+
+ // Second show should!
$('#app-content-files').trigger(new $.Event('show'));
expect(reloadStub.calledOnce).toEqual(true);
reloadStub.restore();