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

Default location on back in empty stack #594

@turnerhayes

Description

@turnerhayes

I don't know if this is a common use case, but I have a case where I want the user to be able to back out of an action, and it might be useful to take them to some default location if the history stack is empty (say, they opened a link in a new tab).

For a little more detail, the user is on a page for joining a game, but if they decide they don't want to join, I want to give them the opportunity to get out easily. My idea is to give them a button to go back, but if their stack is empty, it'll do nothing. That's not the end of the world--they can always close the tab, of course--but it would probably be better to go to the homepage or something. I could use the history API to branch the logic, but it would be handy to be able to do something like

this.props.dispatch(goBack({ default: "/" })

so that it would go to the / route if there's nothing before it on the stack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions