-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix api crash - schedule upcoming length used raw #4195
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged No assets were unchanged |
1dd73d9
to
3412cf3
Compare
WalkthroughThe pull request modifies the Possibly related PRs
Suggested labels
Suggested reviewers
Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/loot-core/src/server/schedules/app.ts (1)
458-458
: Consider adding error handling.To prevent potential crashes, consider wrapping the
getUpcomingDays
call in a try-catch block with a fallback to the default value.- const upcomingLengthValue = getUpcomingDays(upcomingLength[0]?.value ?? '7'); + let upcomingLengthValue; + try { + upcomingLengthValue = getUpcomingDays(upcomingLength[0]?.value ?? '7'); + } catch (err) { + console.error('Failed to get upcoming days:', err); + upcomingLengthValue = 7; + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
upcoming-release-notes/4195.md
is excluded by!**/*.md
📒 Files selected for processing (1)
packages/loot-core/src/server/schedules/app.ts
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Visual regression
- GitHub Check: Functional
- GitHub Check: build (windows-latest)
- GitHub Check: build (ubuntu-latest)
🔇 Additional comments (2)
packages/loot-core/src/server/schedules/app.ts (2)
15-15
: LGTM!The import of
getUpcomingDays
is appropriately placed with other schedule-related utility functions.
458-458
: Verify error handling in getUpcomingDays.The change looks good and fixes the API crash by properly handling the preference value. However, we should verify that
getUpcomingDays
handles invalid inputs gracefully.Let's verify the implementation of
getUpcomingDays
:✅ Verification successful
Error handling in getUpcomingDays is adequate for its usage
The function is only used with controlled inputs from preferences, with a safe fallback to '7'. The current implementation is sufficient as all call sites pass valid values and handle the results appropriately.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check the implementation of getUpcomingDays for error handling ast-grep --pattern 'function getUpcomingDays($_) { $$$ }'Length of output: 1672
Script:
#!/bin/bash # Find all usages of getUpcomingDays function rg "getUpcomingDays" -A 2Length of output: 1743
I missed a place when I updated the values for the pref