-
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
Delete button in right drawer / side pannel #7200
Delete button in right drawer / side pannel #7200
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
This PR adds a delete button to the right drawer/side panel of the show page, addressing issue #7069 by allowing users to delete notes/tasks directly from the side panel.
- Implemented delete functionality in
packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageRightContainer.tsx
- Added a styled component
StyledButtonContainer
for consistent button placement - Utilized
useDeleteOneRecord
hook for record deletion - Conditionally rendered the delete button when the component is in the right drawer
- Improved user experience by enabling quick deletion without navigating to the Notes object list
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
Hello @ehconitin ! It seems that the trash Icon is missing in the button ;) |
@bosiraphael oops, I am yet to finalize changes Raphael. |
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.
Left some comments :)
packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageRightContainer.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageRightContainer.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageRightContainer.tsx
Outdated
Show resolved
Hide resolved
Okay no worries! When you are still working on your PR, you can open a draft PR instead, or just add the label |
@bosiraphael yup yup, will take a note of it for next time :) |
@bosiraphael |
I think the issue of the button being missaligned has something to do with the |
@FelixMalfait
2024-09-25.18-10-15.mp4 |
|
||
const StyledRightDrawerRecord = styled.div` | ||
height: ${({ theme }) => | ||
useIsMobile() ? `calc(100% - ${theme.spacing(16)})` : '100%'}; |
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.
@bosiraphael
This is correct right? this is regarding the height of the right drawer.
Should i just use a local const like in CommandMenu? or create new const file and export it from there to both the files
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.
Second option is better to avoid code duplication :)
@ehconitin yes re-fetching is not a best practise, it throws an additional request to fetch the resource again, while we should instead be able to optimistically predict the result and modify the cache based on that |
Hi @FelixMalfait, I don't have much expertise in this area, unfortunately. @bosiraphael, could you assist with this? For more context, please follow the comment thread here. |
As discussed in Discord, since we introduce Soft Delete, the delete isn't really a delete anymore, so we should instead leverage what's been done for optimistic updates when there's a delete, as what we call "delete" is actually closer to an update. |
@FelixMalfait Understood, I am still thinking about it :(. Ill get back to you! |
… into deleteButtonRightDrawer
Hey @FelixMalfait , I tweaked It's now using I kept I didn't rename it, but I removed the cache eviction step. I didn't create a new Our current What I'm thinking for next steps: For hard deletes, we should use cache.evict in combination with Let me know what do you think! |
@ehconitin sorry but I don't think that's a right approach. There's a reason why there's a "delete" endpoint on the backend, for example we trigger webhook events or can cascade upon deletion. I'm not sure updating deletedAt through the update mutation should be allow at all, it's more a result of our lack of mechanism to prevent this than an active choice. |
@FelixMalfait Also I havent yet renamed anything! |
packages/twenty-front/src/modules/object-record/hooks/useDeleteOneRecordMutation.ts
Show resolved
Hide resolved
Thanks a lot @ehconitin! Our implementation still not perfect but I feel like it's already better than we have today so we should merge! (I just did a small edit). @bosiraphael is working on unifying the action framework so he will refactor that code a bit after it's merged and maybe it'll improve so remaining edge cases (e.g. the fact that on list view we show "delete" and not the destroy action even when viewing the deleted records) |
Thanks @ehconitin for your contribution! |
fixes twentyhq#7069 @Bonapara https://github.com/user-attachments/assets/b1b57070-1ef4-4cc3-9907-028219245558 --------- Co-authored-by: Félix Malfait <[email protected]>
fixes #7069
@Bonapara
2024-09-23.17-42-55.mp4