Skip to content

Conversation

@DOsinga
Copy link
Collaborator

@DOsinga DOsinga commented Nov 12, 2025

Summary

Show cron errors and disable submission for invalid values. also in the process noticed that any errors that bubble up sometimes just get rendered the wrong way

@DOsinga DOsinga requested a review from zanesq November 12, 2025 22:05
@DOsinga DOsinga marked this pull request as ready for review November 12, 2025 22:05
Copilot AI review requested due to automatic review settings November 12, 2025 22:05
Copilot finished reviewing on behalf of DOsinga November 12, 2025 22:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds error handling for invalid cron expressions in the schedule modal and improves error display formatting throughout the app.

Key Changes

  • Adds validation state to disable form submission when cron expressions are invalid
  • Catches and displays errors from the cronstrue library when parsing cron expressions
  • Refactors error rendering to use a consistent errorMessage utility function

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
ui/desktop/src/components/schedule/ScheduleModal.tsx Adds isValid state and disables submit button when cron expression is invalid
ui/desktop/src/components/schedule/CronPicker.tsx Implements error handling for cron parsing with try-catch and validation callback
ui/desktop/src/components/ErrorBoundary.tsx Refactors to use string errors and errorMessage utility for consistent formatting
ui/desktop/src/App.tsx Updates fatal error handling to use errorMessage utility

Comment on lines 141 to 148
try {
const cron = cronstrue.toString(cronWithoutSeconds);
isValid(true);
return cron;
} catch (e) {
isValid(false);
return 'error: ' + errorMessage(e);
}
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Calling isValid() during render (inside getReadable()) violates React best practices - state updates should not occur during render. Move the validation logic to a useEffect that depends on currentCron, and have getReadable() only return the display string without side effects.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants