Skip to content

Commit

Permalink
CW-mention-streams
Browse files Browse the repository at this point in the history
Fix redirect
  • Loading branch information
pvm-code committed Dec 29, 2024
1 parent a90937c commit a5a2d32
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -668,17 +668,24 @@ useEffect(() => {
options: { commonId?: string; messageId?: string } = {}
) => {
const { commonId, messageId } = options;

const queryParamsForPath = {
item: feedItemId,
message: messageId,
};

const isInbox = window.location.pathname === ROUTE_PATHS.INBOX;
if (isInbox && commonId && feedItemId) {
history.push(getCommonPagePath(commonId, queryParamsForPath));
setActiveChatItem({ feedItemId });
return;
}

if (chatItem?.feedItemId === feedItemId && !messageId) {
setActiveChatItem({ feedItemId });
return;
}

const queryParamsForPath = {
item: feedItemId,
message: messageId,
};

if (commonId && commonId !== outerCommon?.id) {
history.push(getCommonPagePath(commonId, queryParamsForPath));
return;
Expand All @@ -699,12 +706,7 @@ useEffect(() => {
const itemExists = allFeedItems.some((item) => item.itemId === feedItemId);

if (itemExists) {
const isInbox = window.location.pathname === ROUTE_PATHS.INBOX;
if(isInbox && commonId) {
history.push(getCommonPagePath(commonId, queryParamsForPath));
} else {
refsByItemId.current[feedItemId]?.scrollToItem();
}
refsByItemId.current[feedItemId]?.scrollToItem();
} else {
onFetchNext(feedItemId);
const paneEl = document.getElementsByClassName('Pane Pane1')[0];
Expand Down

0 comments on commit a5a2d32

Please sign in to comment.