Skip to content

Commit fe57ee3

Browse files
authored
fixed incorrect page navigation with up and down arrow on last item of dashboard repos (#34570)
Previously, pressing the down arrow key on the last item of a list would incorrectly load the latest page when not release key. This commit corrects the logic to ensure that the next page is loaded as intended.
1 parent 4e47148 commit fe57ee3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

web_src/js/components/DashboardRepoList.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ export default defineComponent({
219219
this.searchRepos();
220220
},
221221
222-
changePage(page: number) {
222+
async changePage(page: number) {
223+
if (this.isLoading) return;
224+
223225
this.page = page;
224226
if (this.page > this.finalPage) {
225227
this.page = this.finalPage;
@@ -229,7 +231,7 @@ export default defineComponent({
229231
}
230232
this.repos = [];
231233
this.counts[`${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`] = 0;
232-
this.searchRepos();
234+
await this.searchRepos();
233235
},
234236
235237
async searchRepos() {
@@ -299,7 +301,7 @@ export default defineComponent({
299301
return commitStatus[status].color;
300302
},
301303
302-
reposFilterKeyControl(e: KeyboardEvent) {
304+
async reposFilterKeyControl(e: KeyboardEvent) {
303305
switch (e.key) {
304306
case 'Enter':
305307
document.querySelector<HTMLAnchorElement>('.repo-owner-name-list li.active a')?.click();
@@ -308,7 +310,7 @@ export default defineComponent({
308310
if (this.activeIndex > 0) {
309311
this.activeIndex--;
310312
} else if (this.page > 1) {
311-
this.changePage(this.page - 1);
313+
await this.changePage(this.page - 1);
312314
this.activeIndex = this.searchLimit - 1;
313315
}
314316
break;
@@ -317,17 +319,17 @@ export default defineComponent({
317319
this.activeIndex++;
318320
} else if (this.page < this.finalPage) {
319321
this.activeIndex = 0;
320-
this.changePage(this.page + 1);
322+
await this.changePage(this.page + 1);
321323
}
322324
break;
323325
case 'ArrowRight':
324326
if (this.page < this.finalPage) {
325-
this.changePage(this.page + 1);
327+
await this.changePage(this.page + 1);
326328
}
327329
break;
328330
case 'ArrowLeft':
329331
if (this.page > 1) {
330-
this.changePage(this.page - 1);
332+
await this.changePage(this.page - 1);
331333
}
332334
break;
333335
}

0 commit comments

Comments
 (0)