mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
fix: Grab datasets initially onMount (#13160)
This commit is contained in:
@@ -159,9 +159,11 @@ export default class ResultSet extends React.PureComponent<
|
||||
this.handleExploreBtnClick = this.handleExploreBtnClick.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
async componentDidMount() {
|
||||
// only do this the first time the component is rendered/mounted
|
||||
this.reRunQueryIfSessionTimeoutErrorOnMount();
|
||||
const userDatasetsOwned = await this.getUserDatasets();
|
||||
this.setState({ userDatasetOptions: userDatasetsOwned });
|
||||
}
|
||||
|
||||
UNSAFE_componentWillReceiveProps(nextProps: ResultSetProps) {
|
||||
@@ -296,7 +298,7 @@ export default class ResultSet extends React.PureComponent<
|
||||
});
|
||||
};
|
||||
|
||||
handleSaveDatasetModalSearch = async (searchText: string) => {
|
||||
getUserDatasets = async (searchText = '') => {
|
||||
// Making sure that autocomplete input has a value before rendering the dropdown
|
||||
// Transforming the userDatasetsOwned data for SaveModalComponent)
|
||||
const appContainer = document.getElementById('app');
|
||||
@@ -327,15 +329,18 @@ export default class ResultSet extends React.PureComponent<
|
||||
endpoint: '/api/v1/dataset',
|
||||
})(`q=${queryParams}`);
|
||||
|
||||
const userDatasetsOwned = response.result.map(
|
||||
(r: { table_name: string; id: number }) => ({
|
||||
value: r.table_name,
|
||||
datasetId: r.id,
|
||||
}),
|
||||
);
|
||||
|
||||
this.setState({ userDatasetOptions: userDatasetsOwned });
|
||||
return response.result.map((r: { table_name: string; id: number }) => ({
|
||||
value: r.table_name,
|
||||
datasetId: r.id,
|
||||
}));
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
handleSaveDatasetModalSearch = async (searchText: string) => {
|
||||
const userDatasetsOwned = await this.getUserDatasets(searchText);
|
||||
this.setState({ userDatasetOptions: userDatasetsOwned });
|
||||
};
|
||||
|
||||
handleFilterAutocompleteOption = (
|
||||
|
||||
Reference in New Issue
Block a user