Close note preview modal when clearing note

This commit is contained in:
Jamie Kyle 2024-04-19 06:38:00 -07:00 committed by GitHub
parent 0e7beee5df
commit a51962e9b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,14 +25,19 @@ export const SmartEditNicknameAndNoteModal = memo(
'EditNicknameAndNoteModal requires conversation'
);
const { toggleEditNicknameAndNoteModal } = useGlobalModalActions();
const { toggleEditNicknameAndNoteModal, toggleNotePreviewModal } =
useGlobalModalActions();
const { updateNicknameAndNote } = useConversationsActions();
const handleSave = useCallback(
(nicknameAndNote: NicknameAndNote) => {
// Ensure we don't re-open the note preview modal if there's no note.
if (nicknameAndNote.note == null) {
toggleNotePreviewModal(null);
}
updateNicknameAndNote(conversationId, nicknameAndNote);
},
[conversationId, updateNicknameAndNote]
[conversationId, updateNicknameAndNote, toggleNotePreviewModal]
);
const handleClose = useCallback(() => {