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 Oct 22, 2021
1 parent 0f8cf4b commit 156deac
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 @@ -217,7 +217,6 @@ export const DataTablesPane = ({
},
[queryFormData],
);
console.log(queryFormData);
useEffect(() => {
setInLocalStorage(STORAGE_KEYS.isOpen, panelOpen);
}, [panelOpen]);
Expand Down

0 comments on commit 156deac

Please sign in to comment.