Search parmas
when calling onSearch from useDataGrid, then error automatically removes params
2 Replies
Hi @Su Fly 007. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources provided, I can address your question about search params and the
onSearch
behavior in useDataGrid
.
The issue you're describing, where search params are automatically removed when an error occurs, is not explicitly mentioned in the provided documentation. However, there are a couple of relevant points to consider:
1. The useDataGrid
hook in refine provides functionality for pagination, filtering, and sorting. It includes an onSearch
property that can be used to define custom search behavior MUI DataGrid with Refine (https://refine.dev/blog/mui-datagrid-refine/#filtering).
2. There is a known issue related to filters being reset when changing pages, which might be similar to what you're experiencing GitHub Issue: Filters reset when changing page (https://github.com/refinedev/refine/issues/1825).
3. The useDataGrid
hook has a syncWithLocation
property that, when set to true, encodes the grid's state (including filters and search params) in the URL query parameters useDataGrid syncWithLocation (https://refine.dev/docs/ui-integrations/material-ui/hooks/use-data-grid/#syncwithlocation-).
Given this information, it's possible that the behavior you're seeing is related to how errors are handled in combination with the syncWithLocation
feature. However, the knowledge sources don't provide enough specific information about error handling removing search params automatically.
To troubleshoot this issue, you could try:
1. Checking if syncWithLocation
is set to true in your useDataGrid
configuration.
2. Implementing a custom error handling logic using the errorNotification
property of useDataGrid
useDataGrid errorNotification (https://refine.dev/docs/ui-integrations/material-ui/hooks/use-data-grid/#errornotification).
If the issue persists, it might be worth reporting it as a potential bug to the refine team, as it's not a documented behavior based on the provided knowledge sources.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@617879699363725341> Kapa.ai is still learning and improving, please let me know how I did by reacting below.