Skip to content

If a transition to a particular state+params is pending, attempting to go to that state+params again should be a no-op #42

Closed
@00dani

Description

@00dani

In the current codebase, attempting to go to a state+params identical to your current state+params is a no-op. This is good and makes sense, since there's nothing meaningful to do to transition from your current state+params to your current state+params.

However if you attempt to go to a different state+params, such as by clicking on a ui-sref, a transition is always created and ui-router starts resolving the necessary data. This causes a problem if the user tries to click the same ui-sref twice or more - ui-router will queue up a bunch of identical transitions, waste time retrieving the same resolve data repeatedly, and take much longer to actually switch to the new state.

A request to transition to a state should therefore be ignored if either the requested state is exactly the current state or it is exactly the destination state for the current transition.

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