Skip to content

fix: improve cron scheduler reset behaviour - #422

Open
Cypher-Aura-19 wants to merge 2 commits into
Portabase:mainfrom
Cypher-Aura-19:fix/cron-scheduler-reset-behaviour
Open

fix: improve cron scheduler reset behaviour#422
Cypher-Aura-19 wants to merge 2 commits into
Portabase:mainfrom
Cypher-Aura-19:fix/cron-scheduler-reset-behaviour

Conversation

@Cypher-Aura-19

@Cypher-Aura-19 Cypher-Aura-19 commented Jul 27, 2026

Copy link
Copy Markdown

Summary

  • Make CRON reset update local form state only instead of immediately saving to the backend.
  • Reset to the safer daily default schedule: 0 0 * * *.
  • Sync advanced scheduler fields back to normal dropdown mode when the parent CRON value resets to a standard value.

Testing

  • npx eslint src/features/database/components/cron-advanced-select.tsx src/features/database/components/cron-input.tsx

Notes

  • No paid services or API keys were needed.
  • Backend scheduler behavior was not changed.
  • Full pnpm run lint currently fails locally because next lint resolves lint as an invalid project directory on Windows; targeted ESLint passed for the modified files.

Summary by CodeRabbit

  • Bug Fixes
    • Advanced cron scheduling now remains synchronized when the selected value or available options change.
    • Validation messages are cleared appropriately when cron selection inputs are updated.
    • Resetting a cron schedule now reverts to midnight daily (0 0 * * *) using local state only, without immediately updating the database.
  • Refactor
    • Cron select option lists were consolidated into shared constants for minute/hour/day/month/day-of-week.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7276a95f-4f0e-4a86-96c2-805e03230f73

📥 Commits

Reviewing files that changed from the base of the PR and between 1bceb2b and be257a3.

📒 Files selected for processing (1)
  • src/features/database/components/cron-input.tsx
📜 Recent review details
🔇 Additional comments (1)
src/features/database/components/cron-input.tsx (1)

16-21: LGTM!

Also applies to: 64-64, 74-74, 84-84, 94-94, 104-104, 122-126


📝 Walkthrough

Walkthrough

The cron components resynchronize advanced-selection state and validation errors when inputs change. Cron option lists are centralized, and Reset now updates only local state to 0 0 * * * without persisting the reset.

Changes

Cron UI updates

Layer / File(s) Summary
Advanced selection state synchronization
src/features/database/components/cron-advanced-select.tsx
AdvancedCronSelect derives advanced mode from value and options, clears validation errors, and reruns synchronization when options changes.
Cron input options and reset behavior
src/features/database/components/cron-input.tsx
Cron field options use shared constants, and Reset sets local cron state to 0 0 * * * without calling the database update mutation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A bunny hops through cron at night,
Syncing choices left and right.
Errors vanish, options gleam,
Reset rests in a local dream.
“0 0 * * *”—what a tidy scheme!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main cron reset behavior changes in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/features/database/components/cron-input.tsx

Oops! Something went wrong! :(

ESLint: 9.39.4

TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'configs' -> object with constructor 'Object'
| property 'flat' -> object with constructor 'Object'
| ...
| property 'plugins' -> object with constructor 'Object'
--- property 'react' closes the circle
Referenced from: /.eslintrc.json
at JSON.stringify ()
at /node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2255:45
at Array.map ()
at ConfigValidator.formatErrors (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2246:23)
at ConfigValidator.validateConfigSchema (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2277:84)
at ConfigArrayFactory._normalizeConfigData (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/

... [truncated 446 characters] ...

c/dist/eslintrc.cjs:3261:25)
at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3199:25)
(node:2) ESLintRCWarning: You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details. An eslintrc configuration file is used because you have the ESLINT_USE_FLAT_CONFIG environment variable set to false. If you want to use an eslint.config.js file, remove the environment variable. If you want to find the location of the eslintrc configuration file, use the --debug flag.
(Use node --trace-warnings ... to show where the warning was created)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/features/database/components/cron-advanced-select.tsx`:
- Around line 31-35: Update the options passed from CronInput so their array
identities remain stable across unrelated parent renders by hoisting or
memoizing each inline options array. Ensure the effect in CronAdvancedSelect
only synchronizes customValue, isAdvanced, and error when the option contents or
relevant value actually change, preserving local edits and validation state
during other cron-field updates.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1a537e93-38ed-4b61-83ec-8f46c065a444

📥 Commits

Reviewing files that changed from the base of the PR and between c4c62cb and 1bceb2b.

📒 Files selected for processing (2)
  • src/features/database/components/cron-advanced-select.tsx
  • src/features/database/components/cron-input.tsx
📜 Review details
🔇 Additional comments (1)
src/features/database/components/cron-input.tsx (1)

116-120: LGTM!

Comment thread src/features/database/components/cron-advanced-select.tsx
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.

1 participant