From 12ce205deac6378896196a3d8d7d6597f0101825 Mon Sep 17 00:00:00 2001 From: Grace Guo Date: Mon, 18 Oct 2021 11:09:23 -0700 Subject: [PATCH] fix: sql lab crash caused by invalid template (#17133) --- .../components/ErrorMessage/ParameterErrorMessage.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.tsx index 666ad32169ade..739cfa74a69ed 100644 --- a/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.tsx +++ b/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.tsx @@ -56,7 +56,7 @@ function ParameterErrorMessage({ source = 'sqllab', subtitle, }: ErrorMessageComponentProps) { - const { extra, level, message } = error; + const { extra = { issue_codes: [] }, level, message } = error; const triggerMessage = tn( 'This was triggered by:', @@ -99,9 +99,10 @@ function ParameterErrorMessage({ )} {triggerMessage}
- {extra.issue_codes - .map(issueCode => ) - .reduce((prev, curr) => [prev,
, curr])} + {extra.issue_codes.length > 0 && + extra.issue_codes + .map(issueCode => ) + .reduce((prev, curr) => [prev,
, curr])}

);