From 8017c3cea988f37f053dde234a0a3fd8533b5d34 Mon Sep 17 00:00:00 2001 From: Kiran Ashok Date: Fri, 21 Apr 2023 12:35:57 +0530 Subject: [PATCH] Fix :: Queryname not updating in header while editing in sidebar and saving (#5881) * fix :: queryname not updating in header while editing and saving in sidebar * fix :: for query name update --- frontend/src/Editor/Editor.jsx | 1 + frontend/src/Editor/QueryManager/QueryManager.jsx | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/frontend/src/Editor/Editor.jsx b/frontend/src/Editor/Editor.jsx index b55eaf0fba..84c9636589 100644 --- a/frontend/src/Editor/Editor.jsx +++ b/frontend/src/Editor/Editor.jsx @@ -978,6 +978,7 @@ class EditorComponent extends React.Component { return this.setState({ draftQuery: { ...this.state.draftQuery, name: newName }, renameQueryName: false, + selectedQuery: { ...this.state.selectedQuery, name: newName }, }); } dataqueryService diff --git a/frontend/src/Editor/QueryManager/QueryManager.jsx b/frontend/src/Editor/QueryManager/QueryManager.jsx index 442845d23e..7e35e28e91 100644 --- a/frontend/src/Editor/QueryManager/QueryManager.jsx +++ b/frontend/src/Editor/QueryManager/QueryManager.jsx @@ -167,6 +167,14 @@ class QueryManagerComponent extends React.Component { ); }; + componentDidUpdate(prevState) { + if (prevState?.selectedQuery?.name !== this.state?.selectedQuery?.name) { + this.setState({ + queryName: this.state.selectedQuery?.name, + }); + } + } + componentWillReceiveProps(nextProps) { if (nextProps.loadingDataSources) return; if (this.props.showQueryConfirmation && !nextProps.showQueryConfirmation) {