galwan27 opened a new issue, #44983: URL: https://github.com/apache/superset/issues/44983
### Bug description Description: When a dashboard is copied with "Save as" and "Also copy (duplicate) existing charts" is checked, native filters work on the first load but stop working after the new dashboard is reopened. Steps to reproduce Open a dashboard with native filters scoped to its charts. Use "Save as", check "Also copy (duplicate) existing charts", and save under a new name. Filters work on the new dashboard. Close and reopen the new dashboard. The filters no longer affect the charts. Root cause In DashboardDAO.copy_dashboard (superset/daos/dashboard.py), old_to_new_slice_ids is used to update positions[*].meta.chartId, and in set_dash_metadata only for the legacy filter_scopes. native_filter_configuration[*].chartsInScope and scope.excluded are passed through md.update(...) unchanged. The copied dashboard therefore keeps the original dashboard's chart IDs. The equivalent bug for import was fixed with _remap_chart_ids in superset/commands/dashboard/importers/v1/utils.py (#26338 / #38171). The copy path needs the same remapping. Expected: chartsInScope and scope.excluded refer to the duplicated chart IDs. Actual: They still refer to the original dashboard's chart IDs. Suggested fix: In copy_dashboard, after updating the layout chart IDs, remap native_filter_configuration[*].chartsInScope and scope.excluded using old_to_new_slice_ids. Environment: Reproduced on apache/superset:master (code inspection) and on our deployment 6.1.0. ### Screenshots/recordings _No response_ ### Superset version master / latest-dev ### Python version 3.11 ### Node version 16 ### Browser Chrome ### Additional context _No response_ ### Checklist - [ ] I have searched Superset docs and Slack and didn't find a solution to my problem. - [ ] I have searched the GitHub issue tracker and didn't find a similar bug report. - [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
