Skip to content

Commit

Permalink
feat(explore): clear search on dataset change (#12909)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdotson authored Feb 3, 2021
1 parent 2f6d1ff commit 76c225d
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 76c225d

Please sign in to comment.