From cbc5a8601ad509b9920152de424c63186db7d091 Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Sun, 14 Feb 2021 14:10:14 +0100 Subject: [PATCH] Get favorites on start --- superset-frontend/src/views/CRUD/welcome/ChartTable.tsx | 6 +++++- superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx b/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx index 3fefb0cf5d598..4077b22048fd6 100644 --- a/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx +++ b/superset-frontend/src/views/CRUD/welcome/ChartTable.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import React, { useState, useMemo } from 'react'; +import React, { useState, useMemo, useEffect } from 'react' import { t } from '@superset-ui/core'; import { useListViewResource, @@ -80,6 +80,10 @@ function ChartTable({ const [chartFilter, setChartFilter] = useState('Favorite'); + useEffect(() => { + getData('Favorite').then() + }, []) + const getFilters = (filterName: string) => { const filters = []; diff --git a/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx b/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx index 99bf070b05b81..e9ab7cf221f68 100644 --- a/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx +++ b/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import React, { useState, useMemo } from 'react'; +import React, { useState, useMemo, useEffect } from 'react' import { SupersetClient, t } from '@superset-ui/core'; import { useListViewResource, useFavoriteStatus } from 'src/views/CRUD/hooks'; import { Dashboard, DashboardTableProps } from 'src/views/CRUD/types'; @@ -65,6 +65,10 @@ function DashboardTable({ const [editModal, setEditModal] = useState(); const [dashboardFilter, setDashboardFilter] = useState('Favorite'); + useEffect(() => { + getData('Favorite').then() + }, []) + const handleDashboardEdit = (edits: Dashboard) => SupersetClient.get({ endpoint: `/api/v1/dashboard/${edits.id}`,