-
-
Notifications
You must be signed in to change notification settings - Fork 696
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
Pagination with router params #4698
Conversation
✅ Deploy Preview for volto canceled.
|
✅ Deploy Preview for volto ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Passing run #5489 ↗︎
Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
…nd Search block
c7b9845
to
b35f5d1
Compare
@sneridagh we have reworked this PR and added cypress tests to show that the In the meantime we have fixed the |
@erral @ionlizarazu I've found a problem, see video. When I create a page, then go back to the listing, it's still empty :( so the query is not being triggered on route change for some reason. I've tried on demo and works well. Screen.Recording.2023-05-06.at.11.23.48.mov |
I've added a cypress test for this and fixed it. |
How does this work when I add multiple listing blocks on 1 page? |
|
* @returns {string} Example: page || page_012345678 | ||
*/ | ||
const useCreatePageQueryStringKey = (id) => { | ||
const blockTypesWithPagination = ['search', 'listing']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should come from the config so that addon blocks can use pagination.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the 'blockTypesWithPagination'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ionlizarazu Yes. But it can wait for a future PR, rather than delaying this one.
I tried editing a search block and changing the number of items per page, then saving. The items shown per page updated correctly in edit mode, but after I saved, the view mode was still showing the old number of items per page until I reloaded. |
parseInt( | ||
qs.parse(location.search)?.[pageQueryStringKey] || defaultPage, | ||
), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parsing of the page from the querystring needs to handle a couple edge cases better:
- I navigated to
?page=x
and the pagination showedNaN
- I navigated to
?page=-4
and the block showed no results.
If the value isn't a positive integer, this should probably just use the default page.
This is not an issue we are handling in this PR and it happens in the actual Volto version. Can we manage it in another issue or PR? |
Yes, if it is not a regression from this PR, we can handle it separately. |
Can we merge this? |
@ionlizarazu I also think it's ready, I'll try to merge it this week. |
Co-authored-by: bipoza <bipoza@gmail.com> Co-authored-by: ionlizarazu <ilizarazu@codesyntax.com> Co-authored-by: Unai <uetxaburu@codesyntax.eus>
* master: Release 17.0.0-alpha.14 Linked headlines (#3540) Release notes for 16.20.8 16.21.0 16.21.1 (#4910) Spanish translation (#4896) Refactor Anontools (#4845) Update to plone-backend 6.0.5 (#4897) Release 17.0.0-alpha.13 Enforce max upload size (#4868) Fix and improve the `addStyling` helper (#4880) Release 17.0.0-alpha.12 Fix regression in horizontal scroll in contents view, add it back (#4872) Configurable Container component from registry for some key route views. (#4871) Allow to deselect color in ColorPickerWidget. (#4839) Release 17.0.0-alpha.11 Pagination with router params (#4698) Release 17.0.0-alpha.10 feat(slate): Add css identifier to slate style menu options (#4847) Update Brazilian Portuguese translations (Fixes #4853) Convert header class to function (#4767)
* master: (29 commits) Remove anonymous function calls. Remove default exports from. (#4917) Release 17.0.0-alpha.14 Linked headlines (#3540) Release notes for 16.20.8 16.21.0 16.21.1 (#4910) Spanish translation (#4896) Refactor Anontools (#4845) Update to plone-backend 6.0.5 (#4897) Release 17.0.0-alpha.13 Enforce max upload size (#4868) Fix and improve the `addStyling` helper (#4880) Release 17.0.0-alpha.12 Fix regression in horizontal scroll in contents view, add it back (#4872) Configurable Container component from registry for some key route views. (#4871) Allow to deselect color in ColorPickerWidget. (#4839) Release 17.0.0-alpha.11 Pagination with router params (#4698) Release 17.0.0-alpha.10 feat(slate): Add css identifier to slate style menu options (#4847) Update Brazilian Portuguese translations (Fixes #4853) Convert header class to function (#4767) ...
Fixes #3868 and #4692