msyavuz commented on code in PR #34178: URL: https://github.com/apache/superset/pull/34178#discussion_r2249317457
########## 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: Linter catches it but i think its a warning so if claude code doesn't setup todos properly its easy to miss these. Rerenders are more interesting to me, would be nice to improve perf by accidentaly discovering it -- 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