From ba757dc8da3245e6eb484e8550ebf449552e2fbb Mon Sep 17 00:00:00 2001 From: Basit <1305718+mabaasit@users.noreply.github.com> Date: Mon, 2 Oct 2023 15:01:34 +0200 Subject: [PATCH] fix(search-indexes): avoid flicker when modal closes COMPASS-7248 (#4934) --- .../search-indexes-modals/base-search-index-modal.tsx | 4 ---- packages/compass-indexes/src/modules/search-indexes.ts | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/compass-indexes/src/components/search-indexes-modals/base-search-index-modal.tsx b/packages/compass-indexes/src/components/search-indexes-modals/base-search-index-modal.tsx index fc2bc6a9e1b..73d7c2a0b1f 100644 --- a/packages/compass-indexes/src/components/search-indexes-modals/base-search-index-modal.tsx +++ b/packages/compass-indexes/src/components/search-indexes-modals/base-search-index-modal.tsx @@ -165,10 +165,6 @@ export const BaseSearchIndexModal: React.FunctionComponent< if (isModalOpen) { setIndexName(initialIndexName); setIndexDefinition(initialIndexDefinition); - } else { - // Reset the name and definition when modal is closed. - setIndexName(''); - setIndexDefinition('{}'); setParsingError(undefined); } }, [isModalOpen, initialIndexName, initialIndexDefinition]); diff --git a/packages/compass-indexes/src/modules/search-indexes.ts b/packages/compass-indexes/src/modules/search-indexes.ts index 96d0ae85ef9..3fcdfee83dc 100644 --- a/packages/compass-indexes/src/modules/search-indexes.ts +++ b/packages/compass-indexes/src/modules/search-indexes.ts @@ -360,10 +360,11 @@ export default function reducer( return { ...state, updateIndex: { + // We do not clear the indexName here to avoid flicker created by LG + // Modal as it closes. ...state.updateIndex, isBusy: false, isModalOpen: false, - indexName: '', }, }; }