Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit de64b3b

Browse files
authored
Merge pull request #4774 from withspectrum/remove-history-usage
Remove usage of browser history on server
2 parents cae0368 + cf8ea17 commit de64b3b

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

src/actions/dashboardFeed.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,8 @@
22
import qs from 'query-string';
33
import { storeItem } from 'src/helpers/localStorage';
44
import { LAST_ACTIVE_COMMUNITY_KEY } from 'src/views/dashboard/components/communityList';
5-
import { history } from 'src/helpers/history';
65

76
export const changeActiveThread = (threadId: ?string) => {
8-
let search = qs.parse(history.location.search);
9-
search.t = threadId;
10-
history.push({
11-
...history.location,
12-
search: qs.stringify(search),
13-
});
147
return {
158
type: 'SELECT_FEED_THREAD',
169
threadId,

src/views/dashboard/components/inboxThread/index.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,26 @@ class InboxThread extends React.Component<Props> {
6767
<ErrorBoundary fallbackComponent={null}>
6868
<InboxThreadItem data-cy="thread-card" active={active}>
6969
<InboxLinkWrapper
70-
to={{
71-
pathname: getThreadLink(thread),
72-
state: { modal: !isInbox },
73-
}}
70+
to={
71+
isInbox
72+
? {
73+
pathname: location.pathname,
74+
search: `?t=${thread.id}`,
75+
}
76+
: {
77+
pathname: getThreadLink(thread),
78+
state: { modal: true },
79+
}
80+
}
7481
onClick={evt => {
75-
const isDesktopInbox = isInbox && window.innerWidth > 768;
76-
if (isDesktopInbox) {
82+
const isMobile = window.innerWidth < 768;
83+
if (isMobile && isInbox) {
7784
evt.preventDefault();
85+
this.props.history.push({
86+
pathname: getThreadLink(thread),
87+
state: { modal: true },
88+
});
89+
} else if (!isMobile) {
7890
this.props.dispatch(changeActiveThread(thread.id));
7991
}
8092
}}

0 commit comments

Comments
 (0)