joaopedroab commented on code in PR #38374:
URL: https://github.com/apache/superset/pull/38374#discussion_r2915216085


##########
superset-frontend/plugins/legacy-plugin-chart-map-box/src/MapBox.tsx:
##########
@@ -100,6 +103,12 @@ class MapBox extends Component<MapBoxProps, MapBoxState> {
       ({ latitude, longitude, zoom } = mercator);
     }
 
+    // Override with explicit viewport props when provided (e.g., saved chart 
controls)

Review Comment:
   Good catch! I agree the hardcoded defaults would have overridden `fitBounds` 
for charts where the user never explicitly set a viewport. I've changed the 
control defaults in `controlPanel.ts` from the San Francisco coordinates 
(`-122.405293`, `37.772123`, `11`) to empty strings (`''`). In 
`transformProps`, the new `toFiniteNumber` helper converts empty strings to 
`undefined`, so when the user hasn't touched the viewport controls the props 
come through as `undefined` and `fitBounds` still wins. Only when a user 
explicitly saves a longitude/latitude/zoom will those values be finite numbers 
that take effect.



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