simcha90 commented on a change in pull request #15147:
URL: https://github.com/apache/superset/pull/15147#discussion_r651596088



##########
File path: 
superset-frontend/src/explore/components/controls/DateFilterControl/components/CalendarFrame.tsx
##########
@@ -29,12 +29,15 @@ import {
   FrameComponentProps,
 } from '../types';
 
-export function CalendarFrame(props: FrameComponentProps) {
-  let calendarRange = PreviousCalendarWeek;
-  if (CALENDAR_RANGE_SET.has(props.value as CalendarRangeType)) {
-    calendarRange = props.value;
-  } else {
-    props.onChange(calendarRange);
+export function CalendarFrame({ onChange, value }: FrameComponentProps) {
+  useEffect(() => {
+    if (!CALENDAR_RANGE_SET.has(value as CalendarRangeType)) {
+      onChange(PreviousCalendarWeek);
+    }
+  }, [onChange, value]);
+
+  if (!CALENDAR_RANGE_SET.has(value as CalendarRangeType)) {
+    return null;

Review comment:
       This functionality looks new, why added it?




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

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