korbit-ai[bot] commented on code in PR #35752:
URL: https://github.com/apache/superset/pull/35752#discussion_r2445824383


##########
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/utils.ts:
##########
@@ -50,7 +50,7 @@ export const getDateFormatter = (
 ) =>
   timeFormat === SMART_DATE_ID
     ? getTimeFormatterForGranularity(granularity)
-    : getTimeFormatter(timeFormat ?? fallbackFormat);
+    : getTimeFormatter(timeFormat ?? fallbackFormat, granularity);

Review Comment:
   ### Unnecessary granularity parameter passing <sub>![category 
Performance](https://img.shields.io/badge/Performance-4f46e5)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The granularity parameter is passed to getTimeFormatter on every call when 
timeFormat is not SMART_DATE_ID, even when granularity might be undefined or 
when the formatter doesn't need it.
   
   
   ###### Why this matters
   This could lead to unnecessary processing overhead in the getTimeFormatter 
function if it has to handle or validate the granularity parameter when it's 
not needed, and may cause performance degradation in high-frequency formatting 
scenarios.
   
   ###### Suggested change ∙ *Feature Preview*
   Only pass the granularity parameter when it's defined and needed:
   ```typescript
   : getTimeFormatter(timeFormat ?? fallbackFormat, granularity !== undefined ? 
granularity : undefined);
   ```
   Or check if getTimeFormatter actually requires granularity for non-SMART 
formats and conditionally pass it.
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/9a347e55-c9aa-4700-a97d-c4cdd8f9b810/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/9a347e55-c9aa-4700-a97d-c4cdd8f9b810?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/9a347e55-c9aa-4700-a97d-c4cdd8f9b810?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/9a347e55-c9aa-4700-a97d-c4cdd8f9b810?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/9a347e55-c9aa-4700-a97d-c4cdd8f9b810)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:38208ed9-3ebc-49e9-8365-a903890e5f85 -->
   
   
   [](38208ed9-3ebc-49e9-8365-a903890e5f85)



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