Skip to content

Commit c5da032

Browse files
GiteaBotmetiftikci
andauthored
fixed incorrect page navigation with up and down arrow on last item of dashboard repos (#34570) (#34596)
Backport #34570 by metiftikci Co-authored-by: metiftikci <metiftikci@hotmail.com>
1 parent 3ace45c commit c5da032

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
@@ -218,7 +218,9 @@ export default defineComponent({
218218
this.searchRepos();
219219
},
220220
221-
changePage(page: number) {
221+
async changePage(page: number) {
222+
if (this.isLoading) return;
223+
222224
this.page = page;
223225
if (this.page > this.finalPage) {
224226
this.page = this.finalPage;
@@ -228,7 +230,7 @@ export default defineComponent({
228230
}
229231
this.repos = [];
230232
this.counts[`${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`] = 0;
231-
this.searchRepos();
233+
await this.searchRepos();
232234
},
233235
234236
async searchRepos() {
@@ -298,7 +300,7 @@ export default defineComponent({
298300
return commitStatus[status].color;
299301
},
300302
301-
reposFilterKeyControl(e: KeyboardEvent) {
303+
async reposFilterKeyControl(e: KeyboardEvent) {
302304
switch (e.key) {
303305
case 'Enter':
304306
document.querySelector<HTMLAnchorElement>('.repo-owner-name-list li.active a')?.click();
@@ -307,7 +309,7 @@ export default defineComponent({
307309
if (this.activeIndex > 0) {
308310
this.activeIndex--;
309311
} else if (this.page > 1) {
310-
this.changePage(this.page - 1);
312+
await this.changePage(this.page - 1);
311313
this.activeIndex = this.searchLimit - 1;
312314
}
313315
break;
@@ -316,17 +318,17 @@ export default defineComponent({
316318
this.activeIndex++;
317319
} else if (this.page < this.finalPage) {
318320
this.activeIndex = 0;
319-
this.changePage(this.page + 1);
321+
await this.changePage(this.page + 1);
320322
}
321323
break;
322324
case 'ArrowRight':
323325
if (this.page < this.finalPage) {
324-
this.changePage(this.page + 1);
326+
await this.changePage(this.page + 1);
325327
}
326328
break;
327329
case 'ArrowLeft':
328330
if (this.page > 1) {
329-
this.changePage(this.page - 1);
331+
await this.changePage(this.page - 1);
330332
}
331333
break;
332334
}

0 commit comments

Comments
 (0)