Skip to content

feat(uptime-detectore-schedule-preview): Adding preview section to monitor creation form.#106612

Merged
Abdkhan14 merged 9 commits intomasterfrom
abdk/uptime-detector-schedule-preview
Jan 21, 2026
Merged

feat(uptime-detectore-schedule-preview): Adding preview section to monitor creation form.#106612
Abdkhan14 merged 9 commits intomasterfrom
abdk/uptime-detector-schedule-preview

Conversation

@Abdkhan14
Copy link
Contributor

  • Using the PreviewSchedule
  • Added useUptimeDetectorFormField that assigns defaults when retrieving uptime form fields
  • Consolidated typing around the feature

@Abdkhan14 Abdkhan14 requested a review from a team as a code owner January 20, 2026 21:25
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 20, 2026
cursor[bot]

This comment was marked as outdated.

Copy link
Member

@jaydgoss jaydgoss left a comment

Choose a reason for hiding this comment

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

Issue cursor brought up seems like the only blocker

name: T
): UptimeDetectorFormData[T] {
const value = useFormField(name);
return value || DEFAULT_UPTIME_DETECTOR_FORM_DATA_MAP[name];
Copy link
Member

Choose a reason for hiding this comment

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

l: Did you consider using ?? (nullish coalescing) instead of || here? Using || means falsy values like 0, false, or '' get replaced with defaults. While the current defaults happen to work correctly, ?? would be more precise if you only want to fall back when the value is null/undefined.

Same pattern exists in useCronDetectorFormField in cron/fields.tsx:70.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this was intentional to fallback for when the fields are cleared i.e. ''. You are right about the false value.

Pushed a more explicit check for '' and !defined values instead

const recoveryThreshold = useUptimeDetectorFormField('recoveryThreshold');

const intervalSeconds = useUptimeDetectorFormField('intervalSeconds');
const intervalMinutes = Math.floor(intervalSeconds / 60);
Copy link
Member

Choose a reason for hiding this comment

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

l: Was the truncation with Math.floor(intervalSeconds / 60) intentional? If intervalSeconds is 90, this becomes 1 minute rather than 1.5. Just want to confirm the API expects integer minutes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this, the sample endpoint 400s for non integer minutes, but we have a warning setup for it.

Shouldn't be triggered by the current options:
Screenshot 2026-01-21 at 12 41 29 PM

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Copy link
Member

@jaydgoss jaydgoss left a comment

Choose a reason for hiding this comment

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

m: Not sure if this is intentional or not:

DEFAULT_UPTIME_DETECTOR_FORM_DATA_MAP.timeoutMs is set to 5000, but
uptimeSavedDetectorToFormData returns 10000 as the fallback when a data source
is missing. These should be aligned to avoid inconsistent behavior.

// fields.tsx ~line 49
timeoutMs: 5000, // should be 10000 to match historical default

Consider also using DEFAULT_UPTIME_DETECTOR_FORM_DATA_MAP.timeoutMs in
uptimeSavedDetectorToFormData for consistency, similar to how intervalSeconds,
method, and traceSampling were refactored.

@Abdkhan14
Copy link
Contributor Author

@jaydgoss A little weird but the form assigns a default value of 5s, that gets saved upon creating a monitor.
I'm guessing the 10s wasn't updated at some point.
Screenshot 2026-01-21 at 3 22 25 PM

I kept 5s as the default and used it in uptimeSavedDetectorToFormData.

side: url is the only hardcoded fallback in uptimeSavedDetectorToFormData, we don't want it to be the default during monitor creation.

@Abdkhan14 Abdkhan14 requested a review from jaydgoss January 21, 2026 20:55
@Abdkhan14 Abdkhan14 merged commit c5c95d4 into master Jan 21, 2026
53 checks passed
@Abdkhan14 Abdkhan14 deleted the abdk/uptime-detector-schedule-preview branch January 21, 2026 21:26
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants