lilykuang commented on code in PR #25156: URL: https://github.com/apache/superset/pull/25156#discussion_r1313257360
########## superset-frontend/src/explore/actions/saveModalActions.js: ########## @@ -79,19 +79,15 @@ export const getSlicePayload = ( adhocFilters = extractAddHocFiltersFromFormData(formDataFromSlice); } - if ( - isEmpty(adhocFilters?.adhoc_filters) && - isEmpty(formDataFromSlice) && - formDataWithNativeFilters?.adhoc_filters?.[0]?.operator === - Operators.TEMPORAL_RANGE - ) { - adhocFilters.adhoc_filters = [ - { - ...formDataWithNativeFilters.adhoc_filters[0], - comparator: 'No filter', - }, - ]; - } + // This loop iterates through the adhoc_filters array in formDataWithNativeFilters. + // If a filter is of type TEMPORAL_RANGE and isExtra, it sets its comparator to + // 'No filter' and adds the modified filter to the adhocFilters array. This ensures that all + // TEMPORAL_RANGE filters are converted to 'No filter' when saving a chart. + formDataWithNativeFilters?.adhoc_filters?.forEach(filter => { Review Comment: In the past, we used those checks for `adhocFilters.adhoc_filters` and `formDataFromSlice` being empty because we noticed that the `TEMPORAL_RANGE` filter would disappear when those conditions were met. But as we dug deeper, we found out that this wasn't just happening when both of them were empty. It was also happening when `adhocFilters.adhoc_filters` had another filter. This PR is attempting to address both scenarios, ensuring that the TEMPORAL_RANGE filter is retained properly. -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org