mirror of
https://github.com/mastodon/mastodon.git
synced 2025-07-15 08:48:15 +00:00
fix: 🐛 Add hashtagUrl to target params
so that the variable is avialable outside of useEffect()
This commit is contained in:
parent
fc18ec8bc1
commit
1e672ae66e
|
@ -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 });
|
||||||
|
|
Loading…
Reference in New Issue
Block a user