Close note preview modal when clearing note
This commit is contained in:
parent
0e7beee5df
commit
a51962e9b9
1 changed files with 7 additions and 2 deletions
|
@ -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(() => {
|
||||
|
|
Loading…
Reference in a new issue