Echo 02a7f74976 [Glitch] Profile redesign: Show yourself in follower list
Port bbd88d356d772a5b8210fce06403ccd043a11f1a to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2026-02-11 20:58:54 +01:00

20 lines
548 B
TypeScript

import { useEffect } from 'react';
import { fetchRelationships } from '../actions/accounts';
import { useAppDispatch, useAppSelector } from '../store';
export function useRelationship(accountId?: string | null) {
const relationship = useAppSelector((state) =>
accountId ? state.relationships.get(accountId) : null,
);
const dispatch = useAppDispatch();
useEffect(() => {
if (accountId && !relationship) {
dispatch(fetchRelationships([accountId]));
}
}, [accountId, dispatch, relationship]);
return relationship;
}