Skip to content

Commit

Permalink
clear search on dataset change
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdotson committed Feb 3, 2021
1 parent fab6238 commit e22748b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions superset-frontend/src/explore/components/DatasourcePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export default function DataSourcePanel({
actions,
}: Props) {
const { columns, metrics } = datasource;
const [inputValue, setInputValue] = useState('');
const [lists, setList] = useState({
columns,
metrics,
Expand Down Expand Up @@ -168,6 +169,7 @@ export default function DataSourcePanel({
columns,
metrics,
});
setInputValue('');
}, [columns, datasource, metrics]);

const metricSlice = lists.metrics.slice(0, 50);
Expand All @@ -178,8 +180,10 @@ export default function DataSourcePanel({
<input
type="text"
onChange={evt => {
setInputValue(evt.target.value);
search(evt.target.value);
}}
value={inputValue}
className="form-control input-md"
placeholder={t('Search Metrics & Columns')}
/>
Expand Down

0 comments on commit e22748b

Please sign in to comment.