[Glitch] Fix “Back” button sometimes redirecting out of Mastodon
Port a442a1d1c6
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -20,9 +20,7 @@ export default class ColumnBackButton extends PureComponent {
|
||||
handleClick = () => {
|
||||
const { router } = this.context;
|
||||
|
||||
// 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
|
||||
if (router.route.location.key) {
|
||||
if (router.history.location?.state?.fromMastodon) {
|
||||
router.history.goBack();
|
||||
} else {
|
||||
router.history.push('/');
|
||||
|
Reference in New Issue
Block a user