Remove query params pageIndex and PageSize on non list pages
Currently it by default keeps the pageSize and pageIndex query parameter in the url when visting the show, edit, delete, create page. I want to only have those in the list page
2 Replies
Hi @BlackBearFTW. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To remove the
pageIndex
and pageSize
query parameters from the URL when navigating to non-list pages (such as show, edit, delete, create pages), you can swizzle your data provider and customize the behavior to exclude these parameters.
Here's a step-by-step guide to achieve this:
1. Swizzle the Data Provider: Swizzling allows you to customize the behavior of the data provider. You can remove the query parameters in the list method.
2. Customize the Data Provider: Modify the data provider to exclude pageIndex
and pageSize
from the URL when navigating to non-list pages.
Step-by-Step Implementation
1. Swizzle the Data Provider:
Follow the instructions in the Refine CLI documentation (https://refine.dev/docs/packages/cli/#swizzle) to swizzle your data provider.
2. Modify the Data Provider:
Customize the data provider to remove pageIndex
and pageSize
from the URL when navigating to non-list pages. Here is an example of how you might do this:
3. Use the Custom Data Provider:
Ensure that your application uses the custom data provider.
By following these steps, you can ensure that the pageIndex
and pageSize
query parameters are only included in the URL for list pages and are excluded for other pages like show, edit, delete, and create.
For more detailed information, you can refer to the Refine CLI documentation (https://refine.dev/docs/packages/cli/#swizzle).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@490961337896402944> kapa.ai is still learning and improving, please let us know how it did by reacting below