Skip to content

fix(drag-drop): gracefully handle missing record in initial group during drop#19030

Open
JasonOA888 wants to merge 1 commit intotwentyhq:mainfrom
JasonOA888:fix/issue-16585-drag-drop-error-handling
Open

fix(drag-drop): gracefully handle missing record in initial group during drop#19030
JasonOA888 wants to merge 1 commit intotwentyhq:mainfrom
JasonOA888:fix/issue-16585-drag-drop-error-handling

Conversation

@JasonOA888
Copy link
Copy Markdown

Summary

Fixes #16585

Replace throw new Error() with console.warn() and early return when a record is not found in the initial record group during a drop operation.

Problem

The error Cannot find record id in initial record group ids on drop was being thrown when:

  1. Race conditions occurred during concurrent drag operations
  2. The record had already been moved by another operation
  3. State synchronization was delayed

This caused the app to crash instead of gracefully handling the edge case.

Solution

  • Replace the throw new Error() with console.warn() and early return
  • This allows the app to continue functioning while logging the issue for debugging
  • The drop operation is simply aborted if the record is not found, which is the safe behavior

Testing

  • Verified that the code compiles correctly
  • The fix prevents the Sentry-reported crash from occurring

Changes

  • packages/twenty-front/src/modules/object-record/record-drag/hooks/useUpdateDroppedRecordOnBoard.ts

…ing drop

- Replace throw with console.warn and early return when record is not found
- This prevents app crash during race conditions in concurrent drag operations
- Issue twentyhq#16585
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@github-actions
Copy link
Copy Markdown
Contributor

Welcome!

Hello there, congrats on your first PR! We're excited to have you contributing to this project.
By submitting your Pull Request, you acknowledge that you agree with the terms of our Contributor License Agreement.

Generated by 🚫 dangerJS against 42c8eb2

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

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.

Error: Cannot find record id in initial record group ids on drop, this should not happen

2 participants