diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.tsx b/superset-frontend/src/views/CRUD/chart/ChartList.tsx index 6f3e7b7d5b96..6eed27e6c21d 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 04c0e8c76402..9ae2e4aa254f 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');