alex-poor commented on code in PR #40679:
URL: https://github.com/apache/superset/pull/40679#discussion_r3825127485


##########
superset/models/dashboard.py:
##########
@@ -328,13 +348,27 @@ def data(self) -> dict[str, Any]:
         positions = self.position_json
         if positions:
             positions = json.loads(positions)
+        # Resolve every chart name in one shot; the per-slice 
``localized_name``
+        # lookups below then read from the request memo instead of hitting the
+        # translation hook once per chart. Gated so a disabled deployment does
+        # not pay for the extra pass over the slices.
+        if is_asset_translation_enabled():

Review Comment:
   Good catch — fixed in d182815. You're right that `Dashboard.data` is not the 
path the dashboard renders from, so the prefetch was sitting where it did the 
least good: `/dashboard/<id>/charts` serializes each slice independently and a 
batch hook was still being called once per chart there. That endpoint has the 
whole chart list in hand before serialization, so it now primes the request 
memo first and a dashboard costs one translation call instead of N. The 
`Dashboard.data` prefetch stays (gated) for the callers that do use that 
property.



##########
superset/charts/schemas.py:
##########
@@ -223,6 +227,9 @@ class ChartEntityResponseSchema(Schema):
 
     id = fields.Integer(metadata={"description": id_description})
     slice_name = fields.String(metadata={"description": 
slice_name_description})
+    localized_name = fields.String(

Review Comment:
   Added in d182815 — `localized_name` on `ChartEntityResponseSchema` and 
`ChartGetResponseSchema`, `localized_title` on `DashboardGetResponseSchema`.
   
   One thing worth flagging: this is a surgical edit rather than a 
regeneration. Running `superset update-api-docs` against this branch produced a 
22,799-line diff of which only 6 lines concerned these fields, and it was 
net-negative (12,556 deletions vs 10,243 insertions) because which endpoints 
register depends on local config and feature flags — so committing it would 
have deleted valid content. The checked-in artifact looks substantially stale 
against master; a real refresh seems worth its own PR from an environment with 
the full set of APIs registered. Happy to do that separately if useful.



-- 
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]

Reply via email to