diff --git a/app/client/src/layoutSystems/anvil/integrations/modalSelectors.ts b/app/client/src/layoutSystems/anvil/integrations/modalSelectors.ts index 6b9b20000e2..a222da0b0ad 100644 --- a/app/client/src/layoutSystems/anvil/integrations/modalSelectors.ts +++ b/app/client/src/layoutSystems/anvil/integrations/modalSelectors.ts @@ -4,9 +4,9 @@ import { getAllDetachedWidgetIds, getWidgetsMeta } from "sagas/selectors"; const getCurrentlyOpenWidgets = memoize( (allExistingDetachedWidgets: string[], metaWidgets: Record) => { - return allExistingDetachedWidgets.filter((modalId) => { - const modal = metaWidgets[modalId]; - return modal && modal.isVisible; + return allExistingDetachedWidgets.filter((detachedWidgetId) => { + const detachedWidget = metaWidgets[detachedWidgetId]; + return detachedWidget && detachedWidget.isVisible; }); }, ); diff --git a/app/client/src/widgets/wds/WDSModalWidget/widget/index.tsx b/app/client/src/widgets/wds/WDSModalWidget/widget/index.tsx index 1636b7c7fc5..08bb6bd17f0 100644 --- a/app/client/src/widgets/wds/WDSModalWidget/widget/index.tsx +++ b/app/client/src/widgets/wds/WDSModalWidget/widget/index.tsx @@ -137,25 +137,27 @@ class WDSModalWidget extends BaseWidget { setOpen={(val) => this.setState({ isVisible: val })} size={this.props.size} > - - {this.props.showHeader && ( - - )} - - - - {this.props.showFooter && ( - - )} - + {this.state.isVisible && ( + + {this.props.showHeader && ( + + )} + + + + {this.props.showFooter && ( + + )} + + )} ); }