Skip to content

Commit

Permalink
Fix FilterLiveSearch Loose its Value
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi committed Mar 19, 2021
1 parent df89dbc commit 2108c0b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/ra-ui-materialui/src/list/filter/FilterLiveSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { FC, ChangeEvent, memo } from 'react';
import { FC, ChangeEvent, memo, useMemo } from 'react';
import { InputAdornment } from '@material-ui/core';
import SearchIcon from '@material-ui/icons/Search';
import { Form } from 'react-final-form';
Expand Down Expand Up @@ -36,11 +36,18 @@ const FilterLiveSearch: FC<{ source?: string }> = props => {
}
};

const initialValues = useMemo(
() => ({
[source]: filterValues[source],
}),
[filterValues, source]
);

const onSubmit = () => undefined;

return (
<Form onSubmit={onSubmit}>
{({ handleSubmit }) => (
<Form initialValues={initialValues} onSubmit={onSubmit}>
{() => (
<TextInput
resettable
helperText={false}
Expand Down

0 comments on commit 2108c0b

Please sign in to comment.