Skip to content
Merged
Show file tree
Hide file tree
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
Do not reload the filelist on first open
Fixes: #4644

Without this patch the filelist would always reload. However since not
all the correct data was set yet it would often:

1. fireoff a propfind to ../webdav/
2. fireoff a propfind to ../webdav/<PATH>

When just opening the file list those are the same so the result is just
fine. However if opening a direct link it means that there is a race
condition on which finishes first.

Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer committed May 4, 2017
commit 8d66e325a9375dc06c8105a30e795965e1b73773
11 changes: 10 additions & 1 deletion apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@
*/
initialized: false,

/**
* Wheater the file list was already shown once
* @type boolean
*/
shown: false,

/**
* Number of files per page
*
Expand Down Expand Up @@ -557,7 +563,10 @@
* Event handler when leaving previously hidden state
*/
_onShow: function(e) {
this.reload();
if (this.shown) {
this.reload();
}
this.shown = true;
},

/**
Expand Down
6 changes: 6 additions & 0 deletions apps/files/tests/js/filelistSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down