Skip to content
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

Add possibility to destroy a record #9144

Merged
merged 5 commits into from
Dec 19, 2024
Merged

Conversation

charlesBochet
Copy link
Member

@charlesBochet charlesBochet commented Dec 19, 2024

There are two follow ups to this PR:

  • Bug: sometimes when opening Cmd+K from a deleted record, we are facing a global error
  • On Index page, actions in top right are displaying label and not short name
  • Implement multiple actions once refactoring on delete is complete

Copy link
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.

PR Summary

Added functionality to permanently destroy records through a new action menu option, complementing the existing soft-delete feature with a permanent deletion capability.

  • Added useDestroySingleRecordAction hook in /packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useDestroySingleRecordAction.tsx for permanent record deletion
  • Added destroySingleRecord action configuration in DefaultSingleRecordActionsConfigV2.ts with danger styling and IconTrashX
  • Modified useDeleteSingleRecordAction to prevent deletion of already deleted records via deletedAt check
  • Added IconTrashX to TablerIcons.ts for visual distinction between soft and permanent deletion

4 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +40 to +41
const shouldBeRegistered =
!isRemoteObject && isDefined(selectedRecord?.deletedAt);
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Logic appears reversed - shouldBeRegistered checks for deletedAt being defined, which means it only allows destroying already-deleted records. Should likely be !isDefined(selectedRecord?.deletedAt) to allow destroying non-deleted records.

Comment on lines 62 to 68
onConfirmClick={() => {
handleDeleteClick();
onActionExecutedCallback?.();
if (isInRightDrawer) {
closeRightDrawer();
}
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Modal's onConfirmClick should handle async operation properly. Currently calls callbacks before destroy completes.

@bosiraphael bosiraphael self-assigned this Dec 19, 2024
Copy link
Contributor

@bosiraphael bosiraphael left a comment

Choose a reason for hiding this comment

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

The action delete is still available when selecting multiple records with deleted filter and destroy is not available.

@charlesBochet charlesBochet merged commit 1d62703 into main Dec 19, 2024
12 of 15 checks passed
@charlesBochet charlesBochet deleted the add-destroy-to-index-actions branch December 19, 2024 16:00
mdrazak2001 pushed a commit to mdrazak2001/twenty that referenced this pull request Dec 20, 2024
There are two follow ups to this PR:
- Bug: sometimes when opening Cmd+K from a deleted record, we are facing
a global error
- On Index page, actions in top right are displaying label and not short
name
- Implement multiple actions once refactoring on delete is complete

---------

Co-authored-by: bosiraphael <[email protected]>
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.

2 participants