From ae26967c4eda9fc7f4fbbb49f8c34ffe2c1a8e81 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Thu, 30 Sep 2021 09:29:27 -0300 Subject: [PATCH] fix: Disable lazy loading for the Database selector (#16908) * fix: Disable lazy loading for the Database selector * Fixes the tests --- .../components/DatabaseSelector/DatabaseSelector.test.tsx | 6 +++--- superset-frontend/src/components/DatabaseSelector/index.tsx | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx b/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx index 8e96941f5b..b5ebd044ee 100644 --- a/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx +++ b/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx @@ -180,7 +180,7 @@ test('Refresh should work', async () => { userEvent.click(select); await waitFor(() => { - expect(SupersetClientGet).toBeCalledTimes(1); + expect(SupersetClientGet).toBeCalledTimes(2); expect(props.getDbList).toBeCalledTimes(0); expect(props.getTableList).toBeCalledTimes(0); expect(props.handleError).toBeCalledTimes(0); @@ -193,8 +193,8 @@ test('Refresh should work', async () => { userEvent.click(screen.getByRole('button', { name: 'refresh' })); await waitFor(() => { - expect(SupersetClientGet).toBeCalledTimes(2); - expect(props.getDbList).toBeCalledTimes(0); + expect(SupersetClientGet).toBeCalledTimes(3); + expect(props.getDbList).toBeCalledTimes(1); expect(props.getTableList).toBeCalledTimes(0); expect(props.handleError).toBeCalledTimes(0); expect(props.onDbChange).toBeCalledTimes(0); diff --git a/superset-frontend/src/components/DatabaseSelector/index.tsx b/superset-frontend/src/components/DatabaseSelector/index.tsx index 12f7855561..5d8bccb805 100644 --- a/superset-frontend/src/components/DatabaseSelector/index.tsx +++ b/superset-frontend/src/components/DatabaseSelector/index.tsx @@ -253,6 +253,7 @@ export default function DatabaseSelector({ ariaLabel={t('Select database or type database name')} data-test="select-database" header={{t('Database')}} + lazyLoading={false} onChange={changeDataBase} value={currentDb} placeholder={t('Select database or type database name')}