fix: reevaluated newdashboard bool to ensure that widget doesn't exist, incase of a prior PUT call (#7525)

* fix: reevaluated newdashboard bool to ensure that widget doesn't exist, incase of a prior PUT call

* fix: resolved comment
This commit is contained in:
SagarRajput-7 2025-04-07 15:31:08 +05:30 committed by GitHub
parent 2330420c0d
commit e53d3d1269
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,9 +115,8 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
const widgetId = query.get('widgetId');
const selectedWidget = widgets?.find((e) => e.id === widgetId);
const isWidgetNotPresent = isUndefined(selectedWidget);
if (isWidgetNotPresent) {
setIsNewDashboard(true);
}
setIsNewDashboard(isWidgetNotPresent);
if (!logEventCalledRef.current) {
logEvent('Panel Edit: Page visited', {
@ -131,7 +130,7 @@ function NewWidget({ selectedGraph }: NewWidgetProps): JSX.Element {
logEventCalledRef.current = true;
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [widgets]);
const getWidget = useCallback(() => {
const widgetId = query.get('widgetId');