mikebridge commented on code in PR #45530:
URL: https://github.com/apache/superset/pull/45530#discussion_r4330703439
##########
superset/daos/dashboard.py:
##########
@@ -323,6 +323,94 @@ def reconcile_position_json(positions: object,
dashboard_id: int | None = None)
)
+def _remap_copy_chart_ids(values: list[Any], key_map: dict[str, int]) ->
list[int]:
+ """Drop omitted chart references and use clone IDs when applicable."""
+ new_id: int | None
+ return [
+ new_id for value in values if (new_id := key_map.get(str(value))) is
not None
Review Comment:
Thanks. In practice this can't happen. Chart IDs in `json_metadata` and
`position_json` are written by the frontend as JSON integers (`12`, never
`12.0`), and `json.loads` turns those into `int`, so `str(value)` matches the
clone map's keys. The other copy and import paths key their maps the same way.
Even if a malformed payload did carry a float, the result would be that the
reference is dropped, not pointed at the wrong chart. That's the safe failure
for a copy. Leaving this as is.
--
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]