Upgrade React Router (#3677)
* chore(yarn): Remove react-router * chore(yarn): Remove react-router-scroll * chore(yarn): Remove history * chore(yarn): Add react-router-dom * chore: Remove usages of react-router-scroll * refactor: Upgrade to react-router-web * refactor: Use fork of react-router-scroll This reverts commit 2ddea9a6c8d39fc64b7d0b587f3fbda7a45a7fa2. * fix: Issues mentions in the PR feedback
This commit is contained in:
committed by
Eugen Rochko
parent
1fc6cb4997
commit
8f03fdce7f
@ -9,8 +9,8 @@ class ColumnBackButton extends React.PureComponent {
|
||||
};
|
||||
|
||||
handleClick = () => {
|
||||
if (window.history && window.history.length === 1) this.context.router.push('/');
|
||||
else this.context.router.goBack();
|
||||
if (window.history && window.history.length === 1) this.context.router.history.push('/');
|
||||
else this.context.router.history.goBack();
|
||||
}
|
||||
|
||||
render () {
|
||||
|
@ -9,8 +9,8 @@ class ColumnBackButtonSlim extends React.PureComponent {
|
||||
};
|
||||
|
||||
handleClick = () => {
|
||||
if (window.history && window.history.length === 1) this.context.router.push('/');
|
||||
else this.context.router.goBack();
|
||||
if (window.history && window.history.length === 1) this.context.router.history.push('/');
|
||||
else this.context.router.history.goBack();
|
||||
}
|
||||
|
||||
render () {
|
||||
|
@ -45,8 +45,8 @@ class ColumnHeader extends React.PureComponent {
|
||||
}
|
||||
|
||||
handleBackClick = () => {
|
||||
if (window.history && window.history.length === 1) this.context.router.push('/');
|
||||
else this.context.router.goBack();
|
||||
if (window.history && window.history.length === 1) this.context.router.history.push('/');
|
||||
else this.context.router.history.goBack();
|
||||
}
|
||||
|
||||
handleTransitionEnd = () => {
|
||||
|
@ -41,7 +41,7 @@ class DropdownMenu extends React.PureComponent {
|
||||
action();
|
||||
} else if (to) {
|
||||
e.preventDefault();
|
||||
this.context.router.push(to);
|
||||
this.context.router.history.push(to);
|
||||
}
|
||||
|
||||
this.dropdown.hide();
|
||||
|
@ -17,7 +17,7 @@ class Permalink extends React.PureComponent {
|
||||
handleClick = (e) => {
|
||||
if (e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
||||
e.preventDefault();
|
||||
this.context.router.push(this.props.to);
|
||||
this.context.router.history.push(this.props.to);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,14 +144,14 @@ class Status extends ImmutablePureComponent {
|
||||
|
||||
handleClick = () => {
|
||||
const { status } = this.props;
|
||||
this.context.router.push(`/statuses/${status.getIn(['reblog', 'id'], status.get('id'))}`);
|
||||
this.context.router.history.push(`/statuses/${status.getIn(['reblog', 'id'], status.get('id'))}`);
|
||||
}
|
||||
|
||||
handleAccountClick = (e) => {
|
||||
if (e.button === 0) {
|
||||
const id = Number(e.currentTarget.getAttribute('data-id'));
|
||||
e.preventDefault();
|
||||
this.context.router.push(`/accounts/${id}`);
|
||||
this.context.router.history.push(`/accounts/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ class StatusActionBar extends ImmutablePureComponent {
|
||||
]
|
||||
|
||||
handleReplyClick = () => {
|
||||
this.props.onReply(this.props.status, this.context.router);
|
||||
this.props.onReply(this.props.status, this.context.router.history);
|
||||
}
|
||||
|
||||
handleFavouriteClick = () => {
|
||||
@ -69,7 +69,7 @@ class StatusActionBar extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
handleMentionClick = () => {
|
||||
this.props.onMention(this.props.status.get('account'), this.context.router);
|
||||
this.props.onMention(this.props.status.get('account'), this.context.router.history);
|
||||
}
|
||||
|
||||
handleMuteClick = () => {
|
||||
@ -81,12 +81,12 @@ class StatusActionBar extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
handleOpen = () => {
|
||||
this.context.router.push(`/statuses/${this.props.status.get('id')}`);
|
||||
this.context.router.history.push(`/statuses/${this.props.status.get('id')}`);
|
||||
}
|
||||
|
||||
handleReport = () => {
|
||||
this.props.onReport(this.props.status);
|
||||
this.context.router.push('/report');
|
||||
this.context.router.history.push('/report');
|
||||
}
|
||||
|
||||
handleConversationMuteClick = () => {
|
||||
|
@ -56,7 +56,7 @@ class StatusContent extends React.PureComponent {
|
||||
onMentionClick = (mention, e) => {
|
||||
if (e.button === 0) {
|
||||
e.preventDefault();
|
||||
this.context.router.push(`/accounts/${mention.get('id')}`);
|
||||
this.context.router.history.push(`/accounts/${mention.get('id')}`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ class StatusContent extends React.PureComponent {
|
||||
|
||||
if (e.button === 0) {
|
||||
e.preventDefault();
|
||||
this.context.router.push(`/timelines/tag/${hashtag}`);
|
||||
this.context.router.history.push(`/timelines/tag/${hashtag}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user