Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pages section “page” property does not to work #6735

Open
linusrogge opened this issue Oct 11, 2024 · 2 comments
Open

Pages section “page” property does not to work #6735

linusrogge opened this issue Oct 11, 2024 · 2 comments

Comments

@linusrogge
Copy link

linusrogge commented Oct 11, 2024

Description

If I use the the page: 1 option on a section type: pages, it does not have any effect. No matter if I reload the panel, switch to another page and come back, or log out and in again—the localStorage item (eg. kirby$pagination$/pages/entries/entries with a value of 3) will be saved and I will land on the page where I previously left off.

In the docs, it says “Sets the default page for the pagination. This will overwrite default pagination.” What is the default pagination? Am I understanding this property wrong or does it actually not work?

Looking at the kirby source in

'mixins' => [
'details',
'empty',
'headline',
'help',
'layout',
'min',
'max',
'pagination',
'parent',
'search',
'sort'
],

and also in

'toArray' => function () {
return [
'data' => $this->data,
'errors' => $this->errors,
'options' => [
'add' => $this->add,
'columns' => $this->columnsWithTypes(),
'empty' => $this->empty,
'headline' => $this->headline,
'help' => $this->help,
'layout' => $this->layout,
'link' => $this->link(),
'max' => $this->max,
'min' => $this->min,
'search' => $this->search,
'size' => $this->size,
'sortable' => $this->sortable
],
'pagination' => $this->pagination,
];
}

there does not seem to be anything about the page option. Or should it be included in the pagination prop? Also in the Vue Component (and the ModelsSection.vue) there is not a line about this.

Expected behavior

The pages section should reset to the given page after a reload, changing pages or logging out and in again. So on each visit, so to say, it should start whatever I set the page option to.

To reproduce

  1. Create a type: pages section
  2. Set page option to 1
  3. Fill in data to have multiple pages
  4. Navigate to page 2 and reload/log out and in/switch pages and come back
  5. The section is still on page 2

Your setup

Kirby Version

4.4.1

Your system (please complete the following information)

  • Device: MacBook Pro
  • OS: macOS 15.0.1
  • Browser: Chrome (Arc)
@afbora
Copy link
Member

afbora commented Oct 16, 2024

Summary

This issue happens for two reason:

  1. Default request is 1
    https://github.com/getkirby/kirby/blob/4.4.1/panel/src/components/Sections/ModelsSection.vue#L199-L200
  2. When pagination changed, it stored into kirby$pagination$* local storage.

What should we do? Should we also clear localStorage when the session is ended (logged out) or should we always prioritize the defined page option when the page is first loaded?

@linusrogge
Copy link
Author

I would prefer always landing on the defined page, not only on each new session. At least that’s what this option means to me, judging from the docs. It led to confusion multiple times both for me and clients who use Kirby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants