Skip to content

Commit

Permalink
Get favorites on start
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Apr 16, 2021
1 parent 24d915f commit cbc5a86
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion superset-frontend/src/views/CRUD/welcome/ChartTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -80,6 +80,10 @@ function ChartTable({

const [chartFilter, setChartFilter] = useState('Favorite');

useEffect(() => {
getData('Favorite').then()
}, [])

const getFilters = (filterName: string) => {
const filters = [];

Expand Down
6 changes: 5 additions & 1 deletion superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -65,6 +65,10 @@ function DashboardTable({
const [editModal, setEditModal] = useState<Dashboard>();
const [dashboardFilter, setDashboardFilter] = useState('Favorite');

useEffect(() => {
getData('Favorite').then()
}, [])

const handleDashboardEdit = (edits: Dashboard) =>
SupersetClient.get({
endpoint: `/api/v1/dashboard/${edits.id}`,
Expand Down

0 comments on commit cbc5a86

Please sign in to comment.