Skip to content

Commit 972062f

Browse files
authored
followup of cf#851: fixes row number on submission table after refresh button (#864)
1 parent d268b03 commit 972062f

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

src/components/submission/list.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,8 @@ export default {
266266
}
267267
),
268268
clear: clear && !refresh,
269-
patch: (loaded > 0 && !clear) || (loaded > 0 && refresh)
270-
? (response) => {
271-
if (clear && refresh) this.odata.removeData();
272-
this.odata.addChunk(response.data);
273-
}
269+
patch: loaded > 0 && !clear && !refresh
270+
? (response) => this.odata.addChunk(response.data)
274271
: null
275272
})
276273
.finally(() => { this.refreshing = false; })

src/request-data/submissions.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ export default () => {
3232
nextLink: data['@odata.nextLink']
3333
});
3434
},
35-
removeData() {
36-
odata.value.splice(0, odata.value.length);
37-
},
3835
addChunk(chunk) {
3936
for (const submission of chunk.value) {
4037
odata.value.push(submission);

test/components/submission/list.spec.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,24 @@ describe('SubmissionList', () => {
112112
})
113113
.respondWithData(testData.submissionOData);
114114
});
115+
116+
it('should show correct row number after refresh', () => {
117+
testData.extendedSubmissions.createPast(1);
118+
return loadSubmissionList()
119+
.complete()
120+
.request(component =>
121+
component.get('#submission-list-refresh-button').trigger('click'))
122+
.beforeEachResponse(component => {
123+
testData.extendedSubmissions.createPast(1);
124+
component.get('#odata-loading-message').should.be.hidden();
125+
})
126+
.respondWithData(testData.submissionOData)
127+
.afterResponse(component => {
128+
component.findAllComponents(SubmissionMetadataRow).forEach((r, i) => {
129+
r.props().rowNumber.should.be.equal(2 - i);
130+
});
131+
});
132+
});
115133
});
116134

117135
describe('load by chunk', () => {

0 commit comments

Comments
 (0)