From eb4cdecabb2ff9f266fd130747cecce6902305b7 Mon Sep 17 00:00:00 2001 From: hzrd149 Date: Fri, 30 Jun 2023 08:05:32 -0500 Subject: [PATCH] fix relays not being selected on hashtag view --- src/views/hashtag/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/views/hashtag/index.tsx b/src/views/hashtag/index.tsx index 63ee43ff3..057a99f38 100644 --- a/src/views/hashtag/index.tsx +++ b/src/views/hashtag/index.tsx @@ -27,6 +27,7 @@ import TimelineActionAndStatus from "../../components/timeline-action-and-status import IntersectionObserverProvider from "../../providers/intersection-observer"; import { useTimelineCurserIntersectionCallback } from "../../hooks/use-timeline-cursor-intersection-callback"; import GenericNoteTimeline from "../../components/generric-note-timeline"; +import { unique } from "../../helpers/array"; function EditableControls() { const { isEditing, getSubmitButtonProps, getCancelButtonProps, getEditButtonProps } = useEditableControls(); @@ -52,6 +53,11 @@ export default function HashTagView() { const defaultRelays = useReadRelayUrls(); const [selectedRelays, setSelectedRelays] = useState(defaultRelays); + // add the default relays to the selection when they load + useEffect(() => { + setSelectedRelays((a) => unique([...a, ...defaultRelays])); + }, [defaultRelays.join("|")]); + const relaysModal = useDisclosure(); const { isOpen: showReplies, onToggle } = useDisclosure();