Merge pull request #4693 from nextcloud/fix_4644

Do not reload the filelist on first open
This commit is contained in:
Roeland Jago Douma 2017-05-04 14:37:45 +02:00 committed by GitHub
commit b66dfa909b
2 changed files with 16 additions and 1 deletions

View file

@ -91,6 +91,12 @@
*/
initialized: false,
/**
* Wheater the file list was already shown once
* @type boolean
*/
shown: false,
/**
* Number of files per page
*
@ -557,7 +563,10 @@
* Event handler when leaving previously hidden state
*/
_onShow: function(e) {
this.reload();
if (this.shown) {
this.reload();
}
this.shown = true;
},
/**

View file

@ -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();