fix: 🐛 Add hashtagUrl to target params

so that the variable is avialable outside of useEffect()
This commit is contained in:
Sebastian Hädrich 2025-06-26 03:49:41 +02:00 committed by GitHub
parent fc18ec8bc1
commit 1e672ae66e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,12 +41,13 @@ const isHashtagLink = (
interface TargetParams { interface TargetParams {
hashtag?: string; hashtag?: string;
accountId?: string; accountId?: string;
hashtagUrl?: URL;
} }
export const HashtagMenuController: React.FC = () => { export const HashtagMenuController: React.FC = () => {
const intl = useIntl(); const intl = useIntl();
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const [{ accountId, hashtag }, setTargetParams] = useState<TargetParams>({}); const [{ accountId, hashtag, hashtagUrl }, setTargetParams] = useState<TargetParams>({});
const targetRef = useRef<HTMLAnchorElement | null>(null); const targetRef = useRef<HTMLAnchorElement | null>(null);
const location = useLocation(); const location = useLocation();
const account = useAppSelector((state) => const account = useAppSelector((state) =>
@ -85,7 +86,7 @@ export const HashtagMenuController: React.FC = () => {
e.stopPropagation(); e.stopPropagation();
targetRef.current = target; targetRef.current = target;
setOpen(true); setOpen(true);
setTargetParams({ hashtag, accountId }); setTargetParams({ hashtag, accountId, hashtagUrl });
}; };
document.addEventListener('click', handleClick, { capture: true }); document.addEventListener('click', handleClick, { capture: true });