-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix: melhora a formatação e tratamento de erros na função getExistingSourceIds #1494
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
Conversation
Reviewer's GuideThis PR refactors getExistingSourceIds to dynamically construct SQL parameters and query strings to match placeholders, adds error logging and returns an empty Set instead of null to prevent TypeErrors, and cleans up redundant code in the delete history flow. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
@sourcery-ai review |
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.
Hey @KokeroO - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
src/api/integrations/chatbot/chatwoot/utils/chatwoot-import-helper.ts
Outdated
Show resolved
Hide resolved
@@ -336,7 +338,6 @@ class ChatwootImport { | |||
|
|||
this.deleteHistoryMessages(instance); | |||
this.deleteRepositoryMessagesCache(instance); | |||
return 0; |
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.
@oriondesign2015 Não tem porque ter return 0
aqui. Ninguém espera retorno de importHistoryMessages
@sourcery-ai resolve |
Problema
Mesmo após as correções de #1493 e #1490, em certas ocasiões continuou o erro:
bind message supplies 2 parameters, but prepared statement "" requires 1
Passou a ter o seguinte erro no banco de dados:
Error on import history messages: TypeError: Cannot read properties of null (reading 'has')
Solução
has
não lê valoresnull
, então foi alterado a possibilidade de retorno do valornull
em caso de acionamento do blococatch
Summary by Sourcery
Fix parameter binding and error handling in getExistingSourceIds to prevent SQL parameter count mismatches and avoid returning null
Bug Fixes:
Enhancements:
Chores:
return 0
after message deletion