From b3665d69663673ec9bbdb0486148a5a73d09bf3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Fri, 27 Feb 2026 18:10:31 +0100 Subject: [PATCH] nicolium: restore the code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/nicolium/src/actions/accounts.ts | 14 ++++++++++++-- .../src/queries/accounts/use-relationship.ts | 10 ++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/nicolium/src/actions/accounts.ts b/packages/nicolium/src/actions/accounts.ts index a6a867494..eae52f410 100644 --- a/packages/nicolium/src/actions/accounts.ts +++ b/packages/nicolium/src/actions/accounts.ts @@ -6,6 +6,7 @@ import type { CreateAccountParams, Relationship } from 'pl-api'; const ACCOUNT_BLOCK_SUCCESS = 'ACCOUNT_BLOCK_SUCCESS' as const; const ACCOUNT_MUTE_SUCCESS = 'ACCOUNT_MUTE_SUCCESS' as const; +const ACCOUNT_UNFOLLOW_SUCCESS = 'ACCOUNT_UNFOLLOW_SUCCESS' as const; const createAccount = (params: CreateAccountParams) => (_dispatch: AppDispatch, getState: () => RootState) => @@ -14,9 +15,18 @@ const createAccount = .then((response) => ({ params, response })); type AccountsAction = { - type: typeof ACCOUNT_BLOCK_SUCCESS | typeof ACCOUNT_MUTE_SUCCESS; + type: + | typeof ACCOUNT_BLOCK_SUCCESS + | typeof ACCOUNT_MUTE_SUCCESS + | typeof ACCOUNT_UNFOLLOW_SUCCESS; relationship: Relationship; statuses: Record; }; -export { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS, createAccount, type AccountsAction }; +export { + ACCOUNT_BLOCK_SUCCESS, + ACCOUNT_MUTE_SUCCESS, + ACCOUNT_UNFOLLOW_SUCCESS, + createAccount, + type AccountsAction, +}; diff --git a/packages/nicolium/src/queries/accounts/use-relationship.ts b/packages/nicolium/src/queries/accounts/use-relationship.ts index eb39dcfd5..09ae2737c 100644 --- a/packages/nicolium/src/queries/accounts/use-relationship.ts +++ b/packages/nicolium/src/queries/accounts/use-relationship.ts @@ -4,6 +4,7 @@ import { useMemo } from 'react'; import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS, + ACCOUNT_UNFOLLOW_SUCCESS, type AccountsAction, } from '@/actions/accounts'; import { batcher } from '@/api/batcher'; @@ -121,6 +122,7 @@ const useFollowAccountMutation = (accountId: string) => { const useUnfollowAccountMutation = (accountId: string) => { const client = useClient(); + const dispatch = useAppDispatch(); const queryClient = useQueryClient(); return useMutation({ @@ -142,6 +144,14 @@ const useUnfollowAccountMutation = (accountId: string) => { }, onSuccess: (data) => { queryClient.setQueryData(queryKeys.accountRelationships.show(accountId), data); + + dispatch((dispatch, getState) => { + return dispatch({ + type: ACCOUNT_UNFOLLOW_SUCCESS, + relationship: data, + statuses: getState().statuses, + }); + }); }, }); };