fix(saved-query): handle case where sql_tables in undefined (#11649)

This commit is contained in:
ʈᵃᵢ 2020-11-10 15:26:29 -10:00 committed by GitHub
parent 73cc938358
commit 329e72885c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View File

@ -245,7 +245,7 @@ function SavedQueryList({
{
Cell: ({
row: {
original: { sql_tables: tables },
original: { sql_tables: tables = [] },
},
}: any) => {
const names = tables.map((table: any) => table.table);
@ -385,9 +385,11 @@ function SavedQueryList({
'saved_query',
'database',
createErrorHandler(errMsg =>
t(
'An error occurred while fetching dataset datasource values: %s',
errMsg,
addDangerToast(
t(
'An error occurred while fetching dataset datasource values: %s',
errMsg,
),
),
),
),
@ -403,7 +405,9 @@ function SavedQueryList({
'saved_query',
'schema',
createErrorHandler(errMsg =>
t('An error occurred while fetching schema values: %s', errMsg),
addDangerToast(
t('An error occurred while fetching schema values: %s', errMsg),
),
),
),
paginate: true,
@ -415,7 +419,7 @@ function SavedQueryList({
operator: 'all_text',
},
],
[],
[addDangerToast],
);
return (

View File

@ -57,5 +57,5 @@ export type SavedQueryObject = {
label: string;
schema: string;
sql: string;
sql_tables: Array<{ catalog?: string; schema: string; table: string }>;
sql_tables?: { catalog?: string; schema: string; table: string }[];
};