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 <roeland@famdouma.nl>
*/
initialized: false,
+ /**
+ * Wheater the file list was already shown once
+ * @type boolean
+ */
+ shown: false,
+
/**
* Number of files per page
*
* Event handler when leaving previously hidden state
*/
_onShow: function(e) {
- this.reload();
+ if (this.shown) {
+ this.reload();
+ }
+ this.shown = true;
},
/**
});
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();