From c9c669d179080acd0fd00299016bb106b5c96699 Mon Sep 17 00:00:00 2001 From: wijnanjo Date: Fri, 15 Oct 2021 10:08:57 +0200 Subject: [PATCH] fix for undefined userId (#17117) Co-authored-by: jo.wijnant --- superset-frontend/src/views/CRUD/chart/ChartList.tsx | 2 +- superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.tsx b/superset-frontend/src/views/CRUD/chart/ChartList.tsx index 6f3e7b7d5b966..6eed27e6c21d8 100644 --- a/superset-frontend/src/views/CRUD/chart/ChartList.tsx +++ b/superset-frontend/src/views/CRUD/chart/ChartList.tsx @@ -163,7 +163,7 @@ function ChartList(props: ChartListProps) { const [preparingExport, setPreparingExport] = useState(false); const { userId } = props.user; - const userKey = getFromLocalStorage(userId.toString(), null); + const userKey = getFromLocalStorage(userId?.toString(), null); const openChartImportModal = () => { showImportModal(true); diff --git a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx index 04c0e8c764022..9ae2e4aa254fd 100644 --- a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx +++ b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx @@ -143,7 +143,7 @@ function DashboardList(props: DashboardListProps) { }; const { userId } = props.user; - const userKey = getFromLocalStorage(userId.toString(), null); + const userKey = getFromLocalStorage(userId?.toString(), null); const canCreate = hasPerm('can_write'); const canEdit = hasPerm('can_write');