msyavuz commented on code in PR #36486:
URL: https://github.com/apache/superset/pull/36486#discussion_r2665326075


##########
superset-frontend/packages/superset-ui-core/src/components/TimezoneSelector/index.tsx:
##########
@@ -45,118 +60,142 @@ const offsetsToName = {
   '060': ['GMT Standard Time - London', 'British Summer Time'],
 };
 
-export type TimezoneSelectorProps = {
-  onTimezoneChange: (value: string) => void;
-  timezone?: string | null;
-  minWidth?: string;
-};
+function getOffsetKey(timezoneName: string): string {
+  return (
+    JANUARY_REF.tz(timezoneName).utcOffset().toString() +
+    JULY_REF.tz(timezoneName).utcOffset().toString()
+  );
+}
+
+const timezoneCache = new TimezoneOptionsCache(getOffsetKey, offsetsToName);
+
+// Export function to check if options are cached (for parent components)
+export function areTimezoneOptionsCached(): boolean {
+  return timezoneCache.isCached();
+}
+
+function getTimezoneOptionsAsync(): Promise<TimezoneOption[]> {
+  return timezoneCache.getOptionsAsync();
+}

Review Comment:
   I'm not clear on what you mean. These two functions 
(areTimezoneOptionsCached() and getTimezoneOptionsAsync()) are just thin 
wrappers that call and return the result of the object methods. Using the 
object methods directly would achieve the same result. Could you clarify why 
you prefer exporting the functions over the object, and how it makes testing 
easier? I'm happy to adjust based on your reasoning.



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