Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions desktop/src/features/channels/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,10 @@ export function useUpdateChannelMutation(channelId: string | null) {

return updateChannel({ ...input, channelId });
},
onMutate: () => ({ channelId }),
onSuccess: (updatedChannel) => {
if (!channelId) {
return;
}

queryClient.setQueryData<ChannelDetail>(
channelDetailQueryKey(channelId),
channelDetailQueryKey(updatedChannel.id),
updatedChannel,
);
queryClient.setQueryData<Channel[]>(channelsQueryKey, (current = []) =>
Expand All @@ -365,17 +362,17 @@ export function useUpdateChannelMutation(channelId: string | null) {
),
);
},
onSettled: () => {
onSettled: (_data, _error, _variables, context) => {
// refetchType "none": onSuccess already cached the relay-returned detail;
// awaiting the full channel-list refetch kept the edit dialog stuck on
// "Saving..." (same failure #1360 fixed for create).
void queryClient.invalidateQueries({
queryKey: channelsQueryKey,
refetchType: "none",
});
if (channelId) {
if (context?.channelId) {
void queryClient.invalidateQueries({
queryKey: channelDetailQueryKey(channelId),
queryKey: channelDetailQueryKey(context.channelId),
refetchType: "none",
});
}
Expand Down
Loading
Loading