fix duplicate channel list item

This commit is contained in:
Ren Amamiya 2023-04-24 08:44:29 +07:00
parent e695676bbf
commit d5dd049f43

View File

@ -48,8 +48,6 @@ export const CreateChannelModal = () => {
// publish channel
pool.publish(event, MESSAGE_RELAYS);
// insert to database
createChannel(event.id, event.content, event.created_at);
// update jotai state
setChannel((prev: any) => [
...prev,
@ -62,6 +60,8 @@ export const CreateChannelModal = () => {
// reset form
reset();
setTimeout(() => {
// insert to database
createChannel(event.id, event.content, event.created_at);
// close modal
setOpen(false);
// redirect to channel page