Skip to content

[kbnUrl] reload the route when going from "" to "/" - #8815

Merged
spalger merged 3 commits into
elastic:masterfrom
spalger:fix/missing-reload
Nov 7, 2016
Merged

spalger merged 3 commits into
elastic:masterfrom
spalger:fix/missing-reload

Conversation

@spalger

@spalger spalger commented Oct 24, 2016 •

Copy link
Copy Markdown
Contributor

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.

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.
Comment thread src/ui/public/url/url.js Outdated
if (!route) return false;

if (next.path !== prev.path) return false;
// for the purposes of determining wether there will be a reload,

@stacey-gammon stacey-gammon Oct 24, 2016 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wether = whether :) (fun fact of the day, I now know what to call a castrated ram)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@spalger

spalger commented Nov 4, 2016

Copy link
Copy Markdown
Contributor Author

@stacey-gammon @thomasneirynck would you mind taking another look at this?

@thomasneirynck thomasneirynck left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this and verified it works. LGTM

Comment thread src/ui/public/url/url.js
// for the purposes of determining whether the router will
// automatically be reloading, '' and '/' are equal
const nextPath = next.path || '/';
const prevPath = prev.path || '/';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this made me blink. could be JS interview question ;)

@stacey-gammon stacey-gammon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, LGTM!

@spalger
spalger merged commit 438038b into elastic:master Nov 7, 2016
elastic-jasper added a commit that referenced this pull request Nov 7, 2016
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
spalger pushed a commit that referenced this pull request Nov 8, 2016
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
nreese pushed a commit to nreese/kibana that referenced this pull request Nov 10, 2016
* [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
@epixa epixa added v5.1.1 and removed v5.1.0 labels Dec 8, 2016
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
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
@spalger
spalger deleted the fix/missing-reload branch October 18, 2019 17:40
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
* [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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants