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

refactor(pagination): use route query object instead of param #1626

Merged
merged 2 commits into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/enhancement-pagination-page-param
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Use route query to store active page
fschade marked this conversation as resolved.
Show resolved Hide resolved

We've switched the storage of current paginated page to use route query object instead of param.

https://github.com/owncloud/owncloud-design-system/pull/1626
4 changes: 2 additions & 2 deletions src/components/pagination/OcPagination.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ describe("OcPagination", () => {

expect(Pagination.computed.previousPageLink.call(localThis)).toMatchObject({
name: "files",
params: { page: 2 },
query: { page: 2 },
})
expect(Pagination.computed.nextPageLink.call(localThis)).toMatchObject({
name: "files",
params: { page: 4 },
query: { page: 4 },
})
})
})
7 changes: 2 additions & 5 deletions src/components/pagination/OcPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,8 @@ export default {
bindPageLink(page) {
return {
name: this.currentRoute.name,
query: this.currentRoute.query,
params: {
...this.currentRoute.params,
page,
},
query: { ...this.currentRoute.query, page },
params: this.currentRoute.params,
}
},
},
Expand Down