Remove changing of screen when updating a chat

This commit is contained in:
Chewbacca 2022-11-04 09:49:35 -04:00
parent 4408c6035f
commit 2ecf837656

View file

@ -244,8 +244,6 @@ const useChatActions = (chatId: string) => {
// Optimistically update to the new value
queryClient.setQueryData(ChatKeys.chat(chatId), nextChat);
changeScreen(ChatWidgetScreens.CHAT, nextChat.id);
// Return a context object with the snapshotted value
return { prevChat };
},
@ -255,10 +253,9 @@ const useChatActions = (chatId: string) => {
queryClient.setQueryData(ChatKeys.chat(chatId), context.prevChat);
dispatch(snackbar.error('Chat Settings failed to update.'));
},
onSuccess(response) {
onSuccess() {
queryClient.invalidateQueries(ChatKeys.chat(chatId));
queryClient.invalidateQueries(ChatKeys.chatSearch());
changeScreen(ChatWidgetScreens.CHAT, response.data.id);
dispatch(snackbar.success('Chat Settings updated successfully'));
},
});