mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-06 06:48:21 +00:00
Fixed rename issue on draft query (#6568)
This commit is contained in:
parent
b9210509ec
commit
8bbae02bf8
2 changed files with 5 additions and 9 deletions
|
|
@ -177,15 +177,6 @@ class QueryManagerComponent extends React.Component {
|
|||
}
|
||||
);
|
||||
};
|
||||
componentDidUpdate(prevState) {
|
||||
if (this.state?.selectedQuery?.id == prevState?.selectedQuery?.id) {
|
||||
if (prevState?.selectedQuery?.name !== this.state?.selectedQuery?.name) {
|
||||
this.setState({
|
||||
queryName: this.state.selectedQuery?.name,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||
if (useDataSourcesStore.getState().loadingDataSources) return;
|
||||
|
|
@ -234,6 +225,10 @@ class QueryManagerComponent extends React.Component {
|
|||
return;
|
||||
}
|
||||
|
||||
if (Object.keys(diffProps).length === 1 && nextProps.mode === 'create' && diffProps?.selectedQuery?.name) {
|
||||
return this.setState({ queryName: nextProps.selectedQuery?.name });
|
||||
}
|
||||
|
||||
this.setStateFromProps(nextProps);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ export const QueryCard = ({
|
|||
if (id === 'draftQuery') {
|
||||
toast.success('Query Name Updated');
|
||||
setDraftQuery((query) => ({ ...query, name: newName }));
|
||||
setSelectedQuery('draftQuery', { ...dataQuery, name: newName });
|
||||
} else {
|
||||
renameQuery(dataQuery?.id, newName, fetchDataQueries);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue