Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion superset-frontend/src/features/alerts/AlertReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
key="schedule"
>
<AlertReportCronScheduler
value={currentAlert?.crontab || ALERT_REPORTS_DEFAULT_CRON_VALUE}
value={currentAlert?.crontab || ''}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have much context here but this does look problematic. Is the default being completely ignored? I don't see other uses of the variable. Maybe @eschutho can help here.

@fisjac fisjac Feb 27, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is being set when a new alert/report is generated, so the user should always open the modal to a valid schedule input to start. The problem with the previous implementation is that when the user deletes the input and currentAlert?.crontab === '', it become falsey and resets to the default.

Perhaps we should consider an onBlur property to this field, where bluring an empty value resets to the default?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fisjac I think your idea about the onBlur event might work

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we are validating empty CRON values, this change is fine.

onChange={newVal => updateAlertState('crontab', newVal)}
/>
<StyledInputContainer>
Expand Down