Strictify components/structures/Thread* (#10478)

* Strictify `components/structures/Thread*`

* Fix ThreadView event Id
This commit is contained in:
Michael Weimann
2023-03-30 10:44:28 +02:00
committed by GitHub
parent beb8861df6
commit 052c7e6d27
2 changed files with 37 additions and 11 deletions

View File

@@ -127,7 +127,7 @@ export const ThreadPanelHeader: React.FC<{
PosthogTrackers.trackInteraction("WebRightPanelThreadPanelFilterDropdown", ev);
}}
>
{`${_t("Show:")} ${value.label}`}
{`${_t("Show:")} ${value?.label}`}
</ContextMenuButton>
{contextMenu}
</>
@@ -197,8 +197,8 @@ const EmptyThread: React.FC<EmptyThreadIProps> = ({ hasThreads, filterOption, sh
const ThreadPanel: React.FC<IProps> = ({ roomId, onClose, permalinkCreator }) => {
const mxClient = useContext(MatrixClientContext);
const roomContext = useContext(RoomContext);
const timelinePanel = useRef<TimelinePanel>();
const card = useRef<HTMLDivElement>();
const timelinePanel = useRef<TimelinePanel | null>(null);
const card = useRef<HTMLDivElement | null>(null);
const [filterOption, setFilterOption] = useState<ThreadFilterType>(ThreadFilterType.All);
const [room, setRoom] = useState<Room | null>(null);
@@ -220,7 +220,7 @@ const ThreadPanel: React.FC<IProps> = ({ roomId, onClose, permalinkCreator }) =>
useEffect(() => {
if (timelineSet && !Thread.hasServerSideSupport) {
timelinePanel.current.refreshTimeline();
timelinePanel.current?.refreshTimeline();
}
}, [timelineSet, timelinePanel]);
@@ -246,7 +246,7 @@ const ThreadPanel: React.FC<IProps> = ({ roomId, onClose, permalinkCreator }) =>
withoutScrollContainer={true}
ref={card}
>
<Measured sensor={card.current} onMeasurement={setNarrow} />
{card.current && <Measured sensor={card.current} onMeasurement={setNarrow} />}
{timelineSet ? (
<TimelinePanel
key={filterOption + ":" + (timelineSet.getFilter()?.filterId ?? roomId)}