Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
perf: under the list, after deleting all the data on the current page…
Browse files Browse the repository at this point in the history
…, query the data on the previous page (#557)

Co-authored-by: QuentinHsu <xuquentinyang@gmail.com>
  • Loading branch information
halo-dev-bot and QuentinHsu authored Apr 28, 2022
1 parent 50c178a commit 1d9ba73
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/components/Post/PostListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,11 @@ export default {
const { categoryId } = this.list.params
this.list.params.categoryId = categoryId === 0 ? undefined : categoryId
const response = await apiClient.post.list(this.list.params)
if (response.data.content.length === 0 && this.list.params.page > 0) {
this.list.params.page--
await this.handleListPosts()
return
}
this.list.data = response.data.content
this.list.total = response.data.total
Expand Down
5 changes: 5 additions & 0 deletions src/views/attachment/AttachmentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ export default {
const response = await apiClient.attachment.list(this.list.params)
if (response.data.content.length === 0 && this.list.params.page > 0) {
this.list.params.page--
await this.handleListAttachments()
return
}
this.list.data = response.data.content
this.list.total = response.data.total
this.list.hasNext = response.data.hasNext
Expand Down
5 changes: 5 additions & 0 deletions src/views/comment/components/CommentTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,11 @@ export default {
this.list.loading = true
const response = await apiClient.comment.list(this.targetName, this.list.params)
if (response.data.content.length === 0 && this.list.params.page > 0) {
this.list.params.page--
await this.handleListComments()
return
}
this.list.data = response.data.content
this.list.total = response.data.total
Expand Down
6 changes: 5 additions & 1 deletion src/views/dashboard/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@
{{ item.title }}
</a>

<a herf="javascript:void(0)" v-else-if="item.status === 'DRAFT'" @click="handlePostPreview(item.id)">
<a
herf="javascript:void(0)"
v-else-if="item.status === 'DRAFT'"
@click="handlePostPreview(item.id)"
>
{{ item.title }}
</a>

Expand Down
6 changes: 5 additions & 1 deletion src/views/sheet/components/CustomSheetList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,11 @@ export default {
}
const { data } = await apiClient.sheet.list(this.list.params)
if (data.content.length === 0 && this.list.params.page > 0) {
this.list.params.page--
await this.handleListSheets()
return
}
this.list.data = data.content
this.list.total = data.total
this.list.hasPrevious = data.hasPrevious
Expand Down
5 changes: 5 additions & 0 deletions src/views/sheet/independent/JournalList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ export default {
this.list.loading = true
const { data } = await apiClient.journal.list(this.list.params)
if (data.content.length === 0 && this.list.params.page > 0) {
this.list.params.page--
await this.handleListJournals()
return
}
this.list.data = data.content
this.list.total = data.total
Expand Down
5 changes: 5 additions & 0 deletions src/views/system/developer/tabs/OptionsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ export default {
apiClient.option
.listAsView(this.queryParam)
.then(response => {
if (response.data.content.length === 0 && this.pagination.page > 0) {
this.pagination.page--
this.handleListOptions()
return
}
this.options = response.data.content
this.pagination.total = response.data.total
})
Expand Down

0 comments on commit 1d9ba73

Please sign in to comment.