In visualize, clicking the refresh or
button should refresh the data, but it's currently not refreshing unless there is a change in the query somehow.
Those buttons should always re-fetch the data, otherwise you can't get updated data with a relative time picker.
thx @spalger!
this also is broken in Dashboard, but functions in Discover. This also includes the auto-refresh.
I have identified the problem but am unsure of the best solution
Clicking the refresh for search button in the Visualization Application results in Editor $scope.fetch getting called.
$scope.fetch = function () {
$state.save();
};
During the save process, the event save_with_changes is only emitted when the state has changed.
if (diffResults.keys.length) {
this.emit('save_with_changes', diffResults.keys);
}
The visualize directive only fetches data when the event handler stateMonitor.onChange is triggered.
stateMonitor.onChange((status, type, keys) => {
if (keys[0] === 'vis') {
if ($scope.appState.vis) $scope.vis.setState($scope.appState.vis);
$scope.fetch();
}
if ($scope.vis.type.requiresSearch && ['query', 'filters'].includes(keys[0])) {
$scope.fetch();
}
The problem occurs because the state is saved without any changes and thus the event save_with_changes is never triggered.
Whats the best solution? Should a flag get passed to State.save that forces the event save_with_changes to trigger? Should stateMonitor be updated with the ability to register events on save?
@elastic/kibana-discovery, @elastic/kibana-sharing what are your thoughts? This would affect the query bar globally. Is the expected behavior of the 馃攷 icon to search + refresh?
according to design @Adrian-J, this should be expected behavior but would like to confirm with the other teams as well.
it does make sense though, if you鈥檙e searching for something and click the search button again it should refresh your results
Yes, by clicking the search button you should get the most up-to-date results
not saying it should be looked at as a refresh button but it kind of works as one
This is still an issue in discover when using the 馃攷 button. @ppisljar can you take a look and see if the solution you applied in #12752 is applicable there too?
@spalger When I click the button in Discover, it refreshes the data. Is there anything special you have to do to reproduce this? Or are you on some other version than master?
@lukasolson do you want to follow this up for the time being? Feel free to bounce back to me if it persist.
Hmm, definitely still happening with a completely fresh install and build from master:

$scope.fetch is never called ... seems to be unrelated to original issue. i opened a new issue:
https://github.com/elastic/kibana/issues/13743