react-admin
                                
                                 react-admin copied to clipboard
                                
                                    react-admin copied to clipboard
                            
                            
                            
                        Clearing filters using setFilter({}) does not clear FilterLiveSearch text input
What you were expecting:
When I call setFilter({}) I expected it to clear out all filters and text inside the FilterLiveSearch input box.
What happened instead:
The filters are removed, but the text remains in the FilterLiveSearch input box. The results are not filtering by the text in FilterLiveSearch anymore.
Steps to reproduce:
- Add a FilterLiveSearchcomponent
- Add a button to clear the filter
- Click the button
Related code:
AssetFilterSidebar.jsx
  export const AssetFilterSidebar = (props) => {
    const { setFilters } = useListContext();
    const { data: catData, isLoading: catIsLoading } = useGetList('categories', {
      sort: { field: 'name', order: 'ASC' },
    });
    const { data: companyData, isLoading: companyIsLoading } = useGetList('companies', {
      sort: { field: 'name', order: 'ASC' },
    });
    return (
      <Card sx={{ order: -1, mr: 2, mt: 6, width: 300 }}>
        <CardContent>
          <SavedQueriesList/>
          <FilterLiveSearch source="company#name@_ilike,name@_ilike,serial@_ilike" />
          <Button onClick={() => {
            setFilters({});
          }}>Clear filters</Button>
          <FilterList label="Company" icon={<BusinessIcon/>}>
            {!companyIsLoading && companyData.map((company) => (
              <FilterListItem key={company.name} label={company.name} value={{ 'company#name@_eq': company.name }} />
            ))}
          </FilterList>
          <FilterList label="Category" icon={<CategoryIcon/>}>
            {!catIsLoading && catData.map((cat) => (
              <FilterListItem key={cat.name} label={cat.name} value={{ 'category#name@_eq': cat.name }} />
            ))}
          </FilterList>
        </CardContent>
      </Card>
    );
  };
- Preferably, a sandbox forked from
- https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/simple (v4) Unfortunately the above url is not currently working (once installed, the screen just shows blank)
 
Environment
- React-admin version: 4.16.13
- Last version that did not exhibit the issue (if applicable): na
- React version: 18.2.0
- Browser: chrome 124.0.6367.60
- Stack trace (in case of a JS error): na
Hi @greatwitenorth. Stackblitz have some problems sometimes. You can reload it, wait more or open a new tab with the blank page url to force it to load.
I can't reproduce your bug, could you please try to make a reproduction on Stackblitz
Alternatively you can also use codesandbox: https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple
No news for some time, closing.