-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When using setFilters from the useTable hook, it removes any custom search query previously set using the useSearchParams from react-router library
export const MyComponent: React.FC = () => {
const { setFilters } = useTable();
const [, setSearchParams] = useSearchParams();
return (
<Button
onClick={() => {
setFilters([{ field: "customField", operator: "eq", value: "customValue" }]);
const currentUrlParams = new URLSearchParams(window.location.search);
currentUrlParams.set("customQueryKey", "customQueryValue");
setSearchParams(currentUrlParams);
}}
>
Click me
</Button>
);
};
Steps To Reproduce
-
Add new button component with onClick event
-
Inside onClick try to set the filters from useTable hook and try to set custom key/value in URL params using useSearchParams hook from react-router
Expected behavior
The custom query should be combined with the table filters / sorters
Packages
System:
- OS: Windows 10 10.0.19045
- CPU: (8) x64 Intel(R) Core(TM) i7-9700F CPU @ 3.00GHz
Binaries:
- Node: 22.19.0 - C:\Program Files\nodejs\node.EXE
- Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
- npm: 10.9.3 - C:\Program Files\nodejs\npm.CMD
Browsers:
- Chrome: 141.0.7390.108
Refine Packages:
- @refinedev/antd: 6.0.2
- @refinedev/cli: 2.16.49
- @refinedev/core: 5.0.4
- @refinedev/react-router: 2.0.1
- @refinedev/simple-rest: 6.0.0
Additional Context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working