Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions src/bundled/channels/ChannelsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,15 @@ function ChannelWorkspace({
useEffect(() => {
if (mediaReview && !showingMediaReview) setMediaReview(undefined);
}, [mediaReview, showingMediaReview]);
// Timeline rows are memoized; their callbacks read the shown destination at
// call time so a new navigation request does not rerender every row.
const destination = useRef({ current, navigation });
useLayoutEffect(() => {
destination.current = { current, navigation };
}, [current, navigation]);
const openMediaReview = useCallback(
(messageId: string, attachment: Attachment, initialTime: number) => {
const { current, navigation } = destination.current;
if (!current) return;
setSettings(undefined);
mediaReviewTrigger.current =
Expand All @@ -650,7 +657,7 @@ function ChannelWorkspace({
...(navigation ? { entryId: navigation.entryId } : {}),
});
},
[current, navigation],
[],
);
useEffect(() => {
if (
Expand Down Expand Up @@ -700,6 +707,7 @@ function ChannelWorkspace({
}, [currentId, showingThread?.navigation]);
const openLink = useCallback(
(url: string) => {
const { current, navigation } = destination.current;
const connection = relay.snapshot();
if (
!mounted.current ||
Expand Down Expand Up @@ -747,18 +755,7 @@ function ChannelWorkspace({
}
return false;
},
[
panels,
current,
open,
relay,
queries,
navigation,
select,
navigator,
viewer,
scope,
],
[panels, open, relay, queries, select, navigator, viewer, scope],
);
const panelActive = () => {
const connection = relay.snapshot();
Expand Down
Loading