aminghadersohi commented on code in PR #44237:
URL: https://github.com/apache/superset/pull/44237#discussion_r4013496202
##########
superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx:
##########
@@ -228,20 +241,25 @@ export default function DateFilterLabel(props:
DateFilterControlProps) {
return;
}
if (lastFetchedTimeRange !== timeRangeValue) {
- fetchTimeRange(timeRangeValue).then(({ value: actualRange, error }) =>
{
- if (error) {
- setEvalResponse(error || '');
- setValidTimeRange(false);
- } else {
- setEvalResponse(actualRange || '');
- setValidTimeRange(true);
- }
- setLastFetchedTimeRange(timeRangeValue);
- });
+ latestDraftRequestId.current += 1;
+ const requestId = latestDraftRequestId.current;
+ fetchTimeRange(timeRangeValue, 'col', undefined, displayFormat).then(
+ ({ value: actualRange, error }) => {
+ if (requestId !== latestDraftRequestId.current) return;
Review Comment:
Measured against bito's suggestion below: gating the draft response on
`latestValueRequestId` leaves Apply enabled and the preview showing the applied
range while the popover still holds a draft the backend rejected. The split as
written is correct — don't take 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.
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]