You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've had troubles with double-transitions in many different corner cases. The root cause of this is a mismatch between the $stateParams, and the params decoded from the URL. The solution is to ensure that all values that can map to a url, also map from the url exactly.
Old example (already fixed).
Given the state .state('foo', { url: "/foo/:bar" }) and the transition $state.go("foo", { bar: undefined })
Transitions to states with non-url parameters should be handled correctly too. This is problematic when we re-synchronize the URL, because non-url parameters are obviously not addressed by parsing the URL.
Set inherit: true when performing URL matching
When transitioning to the same state via re-sync url, or via a url match to a child state, the non-url parameters are inherited correctly.
Potential for unintended inherits?
After pushing the URL to $urlRouter following a successful transition, do not attempt to resynchronize in response to a $locationChangeSuccess event.
The transition was the cause of the location change, so re-synchronizing via the URL should be unnecessary.
This is a safety mechanism only. The approach in part 1 should allow url-resync to exactly match the current state anyway.
The text was updated successfully, but these errors were encountered:
We've had troubles with double-transitions in many different corner cases. The root cause of this is a mismatch between the
$stateParams
, and the params decoded from the URL. The solution is to ensure that all values that can map to a url, also map from the url exactly.Old example (already fixed).
Given the state
.state('foo', { url: "/foo/:bar" })
and the transition$state.go("foo", { bar: undefined })
{ bar: undefined }
/foo/
$urlRouter.push("/foo/")
;$urlRouter.listen
handles the $locationChangeSuccess event""
to"/foo/"
)foo
state's matcher)"/foo/"
and matches the empty string. It returns{ bar: "" }
{bar: undefined}
does not equal{ bar: "" }
, so we have "new params"foo
with params{bar: ""}
<--- Double transitionNew example
Given the state
.state('foo', { url: "/foo", params: { bar: null } })
and the transition$state.go("foo", { bar: { blah: 45 } })
{ bar: { blah: 45 } }
/foo
$urlRouter.push("/foo")
;$urlRouter.listen
handles the $locationChangeSuccess event""
to"/foo"
)foo
state's matcher)"/foo"
and returns any matched params. It returns{ }
because there are no params in the url string.{bar: { blah: 45 } }
does not equal{ }
, so we have "new params"foo
with params{ }
<--- Double transitionApproach
Part 1
Part 2
Transitions to states with non-url parameters should be handled correctly too. This is problematic when we re-synchronize the URL, because non-url parameters are obviously not addressed by parsing the URL.
inherit: true
when performing URL matching$urlRouter
following a successful transition, do not attempt to resynchronize in response to a$locationChangeSuccess
event.The text was updated successfully, but these errors were encountered: