Repository navigation
[kbnUrl] reload the route when going from "" to "/" - #8815
Conversation
In timelion the initial route is set to '' which might not be perfectly correct, but works fine. When clicking the "new" button for the first time this causes the route to update from '' to '/', which the kbnUrl service assumes will cause a route change and does not try to force the route to reload. Instead, the router sees this as a noop and the change to the route has no effect unless you click the "new" button a second time.
| if (!route) return false; | ||
|
|
||
| if (next.path !== prev.path) return false; | ||
| // for the purposes of determining wether there will be a reload, |
There was a problem hiding this comment.
wether = whether :) (fun fact of the day, I now know what to call a castrated ram)
There was a problem hiding this comment.
If '_shouldAutoReload' returns true does that mean 'angular should automatically reload so we don't have to manually force a reload', or 'angular will not auto reload, so we should force a reload'? It seems like it should be the former, otherwise it's not really an "auto" reload, it's a "manual" reload, but I think it's the latter, right? I suppose you could argue the semantics either way, but because the name of the function is a bit ambiguous (IMO), I think something along the lines of the comment you left in the conversation of this PR would be helpful in the actual code, or maybe just expanding on the comment you left here.
|
@stacey-gammon @thomasneirynck would you mind taking another look at this? |
| // for the purposes of determining whether the router will | ||
| // automatically be reloading, '' and '/' are equal | ||
| const nextPath = next.path || '/'; | ||
| const prevPath = prev.path || '/'; |
There was a problem hiding this comment.
this made me blink. could be JS interview question ;)
Backports PR #8815 **Commit 1:** [kbnUrl] reload the route when going from "" to "/" In timelion the initial route is set to '' which might not be perfectly correct, but works fine. When clicking the "new" button for the first time this causes the route to update from '' to '/', which the kbnUrl service assumes will cause a route change and does not try to force the route to reload. Instead, the router sees this as a noop and the change to the route has no effect unless you click the "new" button a second time. * Original sha: a7304ec * Authored by spalger <email@spalger.com> on 2016-10-24T20:43:40Z **Commit 2:** [kbnUrl] clarify the purpose _shouldAutoReload * Original sha: fbfbae3 * Authored by spalger <email@spalger.com> on 2016-10-24T23:45:52Z **Commit 3:** [kbnUrl] fix the tests * Original sha: cc9c2f6 * Authored by spalger <email@spalger.com> on 2016-10-25T00:31:22Z
Backports PR #8815 **Commit 1:** [kbnUrl] reload the route when going from "" to "/" In timelion the initial route is set to '' which might not be perfectly correct, but works fine. When clicking the "new" button for the first time this causes the route to update from '' to '/', which the kbnUrl service assumes will cause a route change and does not try to force the route to reload. Instead, the router sees this as a noop and the change to the route has no effect unless you click the "new" button a second time. * Original sha: a7304ec * Authored by spalger <email@spalger.com> on 2016-10-24T20:43:40Z **Commit 2:** [kbnUrl] clarify the purpose _shouldAutoReload * Original sha: fbfbae3 * Authored by spalger <email@spalger.com> on 2016-10-24T23:45:52Z **Commit 3:** [kbnUrl] fix the tests * Original sha: cc9c2f6 * Authored by spalger <email@spalger.com> on 2016-10-25T00:31:22Z
* [kbnUrl] reload the route when going from "" to "/" In timelion the initial route is set to '' which might not be perfectly correct, but works fine. When clicking the "new" button for the first time this causes the route to update from '' to '/', which the kbnUrl service assumes will cause a route change and does not try to force the route to reload. Instead, the router sees this as a noop and the change to the route has no effect unless you click the "new" button a second time. * [kbnUrl] clarify the purpose _shouldAutoReload * [kbnUrl] fix the tests
Backports PR elastic#8815 **Commit 1:** [kbnUrl] reload the route when going from "" to "/" In timelion the initial route is set to '' which might not be perfectly correct, but works fine. When clicking the "new" button for the first time this causes the route to update from '' to '/', which the kbnUrl service assumes will cause a route change and does not try to force the route to reload. Instead, the router sees this as a noop and the change to the route has no effect unless you click the "new" button a second time. * Original sha: a7304ec * Authored by spalger <email@spalger.com> on 2016-10-24T20:43:40Z **Commit 2:** [kbnUrl] clarify the purpose _shouldAutoReload * Original sha: fbfbae3 * Authored by spalger <email@spalger.com> on 2016-10-24T23:45:52Z **Commit 3:** [kbnUrl] fix the tests * Original sha: cc9c2f6 * Authored by spalger <email@spalger.com> on 2016-10-25T00:31:22Z Former-commit-id: fc8cef7
* [kbnUrl] reload the route when going from "" to "/" In timelion the initial route is set to '' which might not be perfectly correct, but works fine. When clicking the "new" button for the first time this causes the route to update from '' to '/', which the kbnUrl service assumes will cause a route change and does not try to force the route to reload. Instead, the router sees this as a noop and the change to the route has no effect unless you click the "new" button a second time. * [kbnUrl] clarify the purpose _shouldAutoReload * [kbnUrl] fix the tests
Fixes #8816
In timelion the initial route is set to '' which might not be perfectly correct, but works fine. When clicking the "new" button for the first time this causes the route to update from '' to '/', which the kbnUrl service assumes will cause a route change and does not try to force the route to reload. Instead, the router sees this as a noop and the change to the route has no effect unless you click the "new" button a second time.