Skip to content

Commit

Permalink
continued refactoring (#16377)
Browse files Browse the repository at this point in the history
  • Loading branch information
AAfghahi authored and eschutho committed Jan 12, 2022
1 parent 9b6b6e1 commit 1183c00
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
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, useEffect } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { t, SupersetTheme, css, useTheme } from '@superset-ui/core';
import Icons from 'src/components/Icons';
Expand Down Expand Up @@ -55,14 +55,13 @@ export default function HeaderReportActionsDropDown({
>(state => state.user || state.explore?.user);
const reportsIds = Object.keys(reports || []);
const report: AlertObject = reports?.[reportsIds[0]];
console.log(report);
const [
currentReportDeleting,
setCurrentReportDeleting,
] = useState<AlertObject | null>(null);
const theme = useTheme();
const [showModal, setShowModal] = useState(false);

const dashboardIdRef = useRef(dashboardId);
const toggleActiveKey = async (data: AlertObject, checked: boolean) => {
if (data?.id) {
toggleActive(data, checked);
Expand Down Expand Up @@ -104,6 +103,23 @@ export default function HeaderReportActionsDropDown({
}
}, []);

useEffect(() => {
if (
canAddReports() &&
dashboardId &&
dashboardId !== dashboardIdRef.current
) {
dispatch(
fetchUISpecificReport({
userId: user.userId,
filterField: 'dashboard_id',
creationMethod: 'dashboards',
resourceId: dashboardId,
}),
);
}
}, [dashboardId]);

const menu = () => (
<Menu selectable={false} css={{ width: '200px' }}>
<Menu.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ export const DataTablesPane = ({
},
[queryFormData, columnNames],
);
console.log(queryFormData);
useEffect(() => {
setItem(LocalStorageKeys.is_datapanel_open, panelOpen);
}, [panelOpen]);
Expand Down

0 comments on commit 1183c00

Please sign in to comment.