From 78a924d378a54aa13e51b5c40494cc109cbc2c63 Mon Sep 17 00:00:00 2001 From: Abhishek Mehandiratta <36722596+abhi12299@users.noreply.github.com> Date: Wed, 9 Oct 2024 13:32:17 +0530 Subject: [PATCH] fix(dashboard): initial title value in rename modal set to currently selected dashboard (#5821) Co-authored-by: Srikanth Chekuri Co-authored-by: SagarRajput-7 <162284829+SagarRajput-7@users.noreply.github.com> --- .../NewDashboard/DashboardDescription/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/src/container/NewDashboard/DashboardDescription/index.tsx b/frontend/src/container/NewDashboard/DashboardDescription/index.tsx index ea59dc4bcf..d6f63165d5 100644 --- a/frontend/src/container/NewDashboard/DashboardDescription/index.tsx +++ b/frontend/src/container/NewDashboard/DashboardDescription/index.tsx @@ -182,6 +182,15 @@ function DashboardDescription(props: DashboardDescriptionProps): JSX.Element { const { t } = useTranslation(['dashboard', 'common']); + // used to set the initial value for the updatedTitle + // the context value is sometimes not available during the initial render + // due to which the updatedTitle is set to some previous value + useEffect(() => { + if (selectedDashboard) { + setUpdatedTitle(selectedDashboard.data.title); + } + }, [selectedDashboard]); + useEffect(() => { if (state.error) { notifications.error({