From 7db34b994e8d613617b052c485e58c59b75960d9 Mon Sep 17 00:00:00 2001 From: Jack <41238731+fisjac@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:23:44 -0500 Subject: [PATCH] fix(screenshots): dashboard screenshots do not capture filter state (#29989) --- .../DownloadMenuItems/DownloadScreenshot.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/dashboard/components/menu/DownloadMenuItems/DownloadScreenshot.tsx b/superset-frontend/src/dashboard/components/menu/DownloadMenuItems/DownloadScreenshot.tsx index 3410accd1..361f9880f 100644 --- a/superset-frontend/src/dashboard/components/menu/DownloadMenuItems/DownloadScreenshot.tsx +++ b/superset-frontend/src/dashboard/components/menu/DownloadMenuItems/DownloadScreenshot.tsx @@ -44,9 +44,19 @@ export default function DownloadScreenshot({ logEvent?: Function; format: string; }) { - const anchor = useSelector( - (state: RootState) => last(state.dashboardState.activeTabs) || undefined, + const activeTabs = useSelector( + (state: RootState) => state.dashboardState.activeTabs || undefined, ); + + const anchor = useSelector( + (state: RootState) => + last(state.dashboardState.directPathToChild) || undefined, + ); + + const dataMask = useSelector( + (state: RootState) => state.dataMask || undefined, + ); + const { addDangerToast, addSuccessToast, addInfoToast } = useToasts(); const onDownloadScreenshot = () => { @@ -106,6 +116,8 @@ export default function DownloadScreenshot({ endpoint: `/api/v1/dashboard/${dashboardId}/cache_dashboard_screenshot`, jsonPayload: { anchor, + activeTabs, + dataMask, }, }) .then(({ json }) => {