fix(schedules): default absent second/minute/hour to 0 when editing#3653
Open
tegan-temporal wants to merge 1 commit into
Open
Conversation
When an existing schedule's structured calendar omits second/minute/hour, getFormSpecFromSpec mapped the missing field to an empty range array. On save that serializes to an omitted field, and the server compiles an empty second/minute/hour range to 'match nothing' (the server only fills the '0' default for the deprecated string CalendarSpec, not a directly-supplied StructuredCalendarSpec), so the edited schedule has no future runs. Fall back to a 0 range for these fields, mirroring dayOfMonth/dayOfWeek/month.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| // An absent second/minute/hour must default to 0, not an empty range. | ||
| // if we use an empty range, that tells the server to exclude everything | ||
| // and no future runs will occur. | ||
| hour: defaultMissingRangeStart( |
Contributor
There was a problem hiding this comment.
⚠️ Argument of type 'IRange[]' is not assignable to parameter of type '{ start?: number | undefined; end?: number | undefined; step?: number | undefined; }[]'.
| calendar.hour ?? [{ start: 0, end: 0, step: 1 }], | ||
| 0, | ||
| ), | ||
| minute: defaultMissingRangeStart( |
Contributor
There was a problem hiding this comment.
⚠️ Argument of type 'IRange[]' is not assignable to parameter of type '{ start?: number | undefined; end?: number | undefined; step?: number | undefined; }[]'.
| calendar.minute ?? [{ start: 0, end: 0, step: 1 }], | ||
| 0, | ||
| ), | ||
| second: defaultMissingRangeStart( |
Contributor
There was a problem hiding this comment.
⚠️ Argument of type 'IRange[]' is not assignable to parameter of type '{ start?: number | undefined; end?: number | undefined; step?: number | undefined; }[]'.
| second: defaultMissingRangeStart( | ||
| calendar.second ?? [{ start: 0, end: 0, step: 1 }], | ||
| 0, | ||
| ), |
Contributor
There was a problem hiding this comment.
⚠️ Type 'IRange[]' is not assignable to type '{ start: number; end?: number | undefined; step?: number | undefined; }[]'.
| calendar.second ?? [{ start: 0, end: 0, step: 1 }], | ||
| 0, | ||
| ), | ||
| month: calendar.month ?? [{ start: 1, end: 12, step: 1 }], |
Contributor
There was a problem hiding this comment.
⚠️ Type 'IRange[] | null | undefined' is not assignable to type '{ start: number; end?: number | undefined; step?: number | undefined; }[] | undefined'.
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Editing a schedule whose structured calendar omits
second/minute/hourleft it with no future runs.getFormSpecFromSpecmapped a missing time field to an empty range array. On save that serializes to an omitted field, and the server compiles an emptysecond/minute/hourrange to match nothing — the0default is only filled for the deprecated stringCalendarSpec, not a directly-suppliedStructuredCalendarSpec.Fix
Fall back to a
0range for these fields, mirroring howdayOfMonth/dayOfWeek/monthalready handle absent fields. Test updated.