-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Conversation
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.
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 inDefaultSingleRecordActionsConfigV2.ts
with danger styling and IconTrashX - Modified
useDeleteSingleRecordAction
to prevent deletion of already deleted records viadeletedAt
check - Added
IconTrashX
toTablerIcons.ts
for visual distinction between soft and permanent deletion
4 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile
...on-menu/actions/record-actions/single-record/constants/DefaultSingleRecordActionsConfigV2.ts
Show resolved
Hide resolved
const shouldBeRegistered = | ||
!isRemoteObject && isDefined(selectedRecord?.deletedAt); |
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.
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.
...ules/action-menu/actions/record-actions/single-record/hooks/useDestroySingleRecordAction.tsx
Show resolved
Hide resolved
onConfirmClick={() => { | ||
handleDeleteClick(); | ||
onActionExecutedCallback?.(); | ||
if (isInRightDrawer) { | ||
closeRightDrawer(); | ||
} | ||
}} |
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.
style: Modal's onConfirmClick should handle async operation properly. Currently calls callbacks before destroy completes.
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.
The action delete is still available when selecting multiple records with deleted filter and destroy is not available.
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]>
There are two follow ups to this PR: