Skip to content

Commit

Permalink
Merge pull request #6923 from getkirby/fix/6735-sections-pagination-page
Browse files Browse the repository at this point in the history
Fix `page` on models sections + use sessionStorage
  • Loading branch information
bastianallgeier authored Jan 20, 2025
2 parents cce3151 + cfc4618 commit efad7c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/sections/mixins/pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
return $limit;
},
/**
* Sets the default page for the pagination. This will overwrite default pagination.
* Sets the default page for the pagination.
*/
'page' => function (int|null $page = null) {
return App::instance()->request()->get('page', $page);
Expand Down
8 changes: 5 additions & 3 deletions panel/src/components/Sections/ModelsSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default {
...this.emptyProps,
text: this.searching
? this.$t("search.results.none")
: this.options.empty ?? this.emptyProps.text
: (this.options.empty ?? this.emptyProps.text)
};
},
items() {
Expand Down Expand Up @@ -197,7 +197,9 @@ export default {
}
const page =
this.pagination.page ?? localStorage.getItem(this.paginationId) ?? 1;
this.pagination.page ??
sessionStorage.getItem(this.paginationId) ??
null;
try {
const response = await this.$api.get(
Expand All @@ -222,7 +224,7 @@ export default {
onDrop() {},
onSort() {},
onPaginate(pagination) {
localStorage.setItem(this.paginationId, pagination.page);
sessionStorage.setItem(this.paginationId, pagination.page);
this.pagination = pagination;
this.reload();
},
Expand Down

0 comments on commit efad7c1

Please sign in to comment.