mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Stop Discover's Visualize button from loading incorrect URL
When App state is read from the url, it is accessed via `$location.search()`. It turns out that the result of `$location.search()` is a mutable object that allows you to modify the results of `$location.search()` without actually modifying the URL. When a user clicks a field in the Discover sidebar, it executes the scope method `vizLocation` to get the href value for the "Visualize" button. As an unintended side effect, `vizLocation` was modifying the object returned from `$location.search()`. This change would ultimately be read when the Visualize app loaded instead of the param in the actual URL since there's no full page load from Discover -> Visualize. To make things more complicated, I believe there was a race condition partially masking this issue. Since `vizLocation` is used in an Angular string template, the data binding causes it to execute on every digest cycle. This is why the incorrect value continued to be written to `$location.search()` even after `visLocation` ran for the correct field. It also meant that the result of `$location.search()` was totally dependent on which field `vizLocation` ran for most recently before the user clicked Visualize. Fixes https://github.com/elastic/kibana/issues/8718
This commit is contained in:
parent
ff01707352
commit
d0d926b8a9
1 changed files with 1 additions and 1 deletions
|
@ -194,7 +194,7 @@ app.directive('discFieldChooser', function ($location, globalState, config, $rou
|
|||
};
|
||||
}
|
||||
|
||||
return '#/visualize/create?' + $.param(_.assign($location.search(), {
|
||||
return '#/visualize/create?' + $.param(_.assign(_.clone($location.search()), {
|
||||
indexPattern: $scope.state.index,
|
||||
type: type,
|
||||
_a: rison.encode({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue