Fix “Back” button sometimes redirecting out of Mastodon (#25281)
This commit is contained in:
parent
d0f00206dc
commit
a442a1d1c6
4 changed files with 40 additions and 14 deletions
|
@ -23,9 +23,7 @@ export default class ColumnBackButton extends PureComponent {
|
|||
|
||||
if (onClick) {
|
||||
onClick();
|
||||
// Check if there is a previous page in the app to go back to per https://stackoverflow.com/a/70532858/9703201
|
||||
// When upgrading to V6, check `location.key !== 'default'` instead per https://github.com/remix-run/history/blob/main/docs/api-reference.md#location
|
||||
} else if (router.route.location.key) {
|
||||
} else if (router.history.location?.state?.fromMastodon) {
|
||||
router.history.goBack();
|
||||
} else {
|
||||
router.history.push('/');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue