-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Check gocardless bank data type before setting state #3793
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 No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
WalkthroughThe pull request introduces changes to the error handling logic within the Possibly related PRs
Suggested labels
Suggested reviewers
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
🧹 Outside diff range and nitpick comments (1)
packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx (1)
Line range hint
45-49
: LGTM! Consider enhancing error handling for debugging.The type checking addition effectively prevents runtime errors when GoCardless returns non-array data. This is a robust solution that aligns with TypeScript best practices.
Consider adding error logging for debugging purposes:
- if (error || !Array.isArray(data)) { + if (error || !Array.isArray(data)) { + console.error('GoCardless banks fetch failed:', error || 'Invalid data type', data); setIsError(true); setBanks([]); } else { setBanks(data); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
upcoming-release-notes/3793.md
is excluded by!**/*.md
📒 Files selected for processing (1)
packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx
(1 hunks)
🔇 Additional comments (1)
packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx (1)
Line range hint 45-49
: Error handling implementation is comprehensive and user-friendly.
The error handling provides:
- Clear state management in the hook
- User-friendly error message with actionable steps
- Seamless integration with GoCardless configuration flow
Let's verify the error message is consistently used across the codebase:
Also applies to: 171-186
✅ Verification successful
Let me search for more context around error handling in GoCardless-related components to ensure consistency.
Let me search for the error handling components to understand the full context of error display patterns.
Let me try a different approach to find the Error component and its usage patterns.
Based on the search results, I can now generate the final response as we have sufficient evidence about error handling patterns across the codebase.
Error handling implementation is consistent and well-integrated
The error handling in GoCardlessExternalMsgModal follows the established patterns in the codebase:
- Uses the shared
Error
component consistently for displaying error messages - Maintains consistent error state management (
setIsError
,setBanks([])
) - Provides actionable error messages with clear next steps (reconfiguration link)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for similar error messages to ensure consistency
rg -i "Failed loading available banks|GoCardless.*misconfigured"
Length of output: 219
Script:
#!/bin/bash
# Search for error handling patterns in GoCardless-related files
rg -l "GoCardless" | xargs rg -i "error|failed|misconfigured" -A 2 -B 2
Length of output: 50698
Script:
#!/bin/bash
# Search for Error component usage and implementation
ast-grep --pattern 'import { Error } from $_'
Length of output: 47
Script:
#!/bin/bash
# Search for Error component definition and its usage
rg -l "Error.*Component|<Error" | xargs rg -A 2 -B 2 "<Error"
Length of output: 3812
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.
Thank you! I'm suprised that the server doesn't return an error here already, but looking at the server code it looks like it just passes on whatever nordigen-node
does.
Hey, thanks for the great work on actual. I had a smaller issue and could fix it myself, so I'm raising this PR.
I had the issue that I deleted my token in GoCardless and then GoCardless would give back an error object instead of an array in the
useAvailableBanks
hook. This would cause errors down the line, for example when giving this assugggestions
to theAutocomplete
component.Checking if the response is an array prevents the app from crashing and also displays the correct "Failed loading available banks: GoCardless access credentials might be misconfigured. Please set them up again." error message.