msyavuz commented on code in PR #34178: URL: https://github.com/apache/superset/pull/34178#discussion_r2249309600
########## superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx: ########## @@ -85,63 +60,59 @@ const DropdownItemExtension = extensionsRegistry.get( 'report-modal.dropdown.item.icon', ); -export enum CreationMethod { - Charts = 'charts', - Dashboards = 'dashboards', -} export interface HeaderReportProps { dashboardId?: number; chart?: ChartState; - useTextMenu?: boolean; - setShowReportSubMenu?: (show: boolean) => void; - showReportSubMenu?: boolean; - submenuTitle?: string; showReportModal: () => void; setCurrentReportDeleting: (report: AlertObject | null) => void; } -// Same instance to be used in useEffects -const EMPTY_OBJECT = {}; - -export default function HeaderReportDropDown({ +export const useHeaderReportMenuItems = ({ dashboardId, chart, - useTextMenu = false, - setShowReportSubMenu, - submenuTitle, showReportModal, setCurrentReportDeleting, -}: HeaderReportProps) { +}: HeaderReportProps): MenuItem | null => { const dispatch = useDispatch(); - const report = useSelector<any, AlertObject>(state => { - const resourceType = dashboardId - ? CreationMethod.Dashboards - : CreationMethod.Charts; - return ( - reportSelector(state, resourceType, dashboardId || chart?.id) || - EMPTY_OBJECT - ); + const resourceId = dashboardId || chart?.id; + const resourceType = dashboardId + ? CreationMethod.Dashboards + : CreationMethod.Charts; + + // Select the reports state and specific report with proper reactivity + const report = useSelector<any, AlertObject | null>(state => { + if (!resourceId) return null; + // Select directly from the reports state to ensure reactivity + const reportsState = state.reports || {}; + const resourceTypeReports = reportsState[resourceType] || {}; + const reportData = resourceTypeReports[resourceId]; + + // Debug logging to understand what's happening Review Comment: Not sure what’s going on here. @geido I believe you worked on this part. Would you have time to look into it in your follow-up PR? If not, I can investigate it separately, just let me know what works best for you. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org