kgabryje commented on code in PR #30002:
URL: https://github.com/apache/superset/pull/30002#discussion_r1728602734


##########
superset-frontend/src/explore/components/controls/ComparisonRangeLabel.tsx:
##########
@@ -108,20 +108,61 @@ export const ComparisonRangeLabel = ({
         );
       }
       const promises = currentTimeRangeFilters.map(filter => {
-        const newShifts = getTimeOffset({
-          timeRangeFilter: filter,
-          shifts: shiftsArray,
-          startDate: useStartDate,
-          includeFutureOffsets: false, // So we don't trigger requests for 
future dates
-        });
+        const nonCustomNorInheritShifts =
+          shiftsArray.filter(
+            (shift: string) => shift !== 'custom' && shift !== 'inherit',
+          ) || [];
+        const customOrInheritShifts =
+          shiftsArray.filter(
+            (shift: string) => shift === 'custom' || shift === 'inherit',
+          ) || [];
 
-        if (!isEmpty(newShifts)) {
+        // There's no custom or inherit to compute, so we can just fetch the 
time range
+        if (isEmpty(customOrInheritShifts)) {
           return fetchTimeRange(
             filter.comparator,
             filter.subject,
-            ensureIsArray(newShifts),
+            ensureIsArray(nonCustomNorInheritShifts),
           );
         }
+        // Need to compute custom or inherit shifts first and then mix with 
the non custom or inherit shifts
+        if (
+          (ensureIsArray(customOrInheritShifts).includes('custom') &&
+            startDate) ||
+          ensureIsArray(customOrInheritShifts).includes('inherit')
+        ) {
+          return fetchTimeRange(filter.comparator, filter.subject).then(res => 
{
+            const datePattern = /\d{4}-\d{2}-\d{2}/g;

Review Comment:
   Can we move it to a const, since we’re using it in many files?



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