Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-refresh/🔎 in visualize don't refresh the data #12733

Closed
spalger opened this issue Jul 10, 2017 · 10 comments · Fixed by #12752
Closed

Auto-refresh/🔎 in visualize don't refresh the data #12733

spalger opened this issue Jul 10, 2017 · 10 comments · Fixed by #12752
Assignees
Labels
blocker bug Fixes for quality problems that affect the customer experience Feature:Visualizations Generic visualization features (in case no more specific feature label is available) PR sent v6.0.0-beta1 v6.0.0

Comments

@spalger
Copy link
Contributor

spalger commented Jul 10, 2017

In visualize, clicking the refresh or image 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.

@spalger spalger added :Discovery blocker bug Fixes for quality problems that affect the customer experience labels Jul 10, 2017
@thomasneirynck
Copy link
Contributor

thx @spalger!

@thomasneirynck thomasneirynck added Feature:Visualizations Generic visualization features (in case no more specific feature label is available) v6.0.0 v6.0.0-beta1 and removed :Discovery labels Jul 10, 2017
@thomasneirynck
Copy link
Contributor

thomasneirynck commented Jul 10, 2017

this also is broken in Dashboard, but functions in Discover. This also includes the auto-refresh.

@thomasneirynck thomasneirynck changed the title Refresh/🔎 in visualize don't refresh the data Auto-refresh/🔎 in visualize don't refresh the data Jul 10, 2017
@ppisljar ppisljar self-assigned this Jul 11, 2017
@nreese
Copy link
Contributor

nreese commented Jul 11, 2017

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?

@alexfrancoeur
Copy link

@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?

@alexfrancoeur
Copy link

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’re 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

@spalger
Copy link
Contributor Author

spalger commented Aug 16, 2017

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 spalger reopened this Aug 16, 2017
@lukasolson
Copy link
Member

@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?

@thomasneirynck
Copy link
Contributor

@lukasolson do you want to follow this up for the time being? Feel free to bounce back to me if it persist.

@spalger
Copy link
Contributor Author

spalger commented Aug 24, 2017

Hmm, definitely still happening with a completely fresh install and build from master:

click doesn t search

@ppisljar
Copy link
Member

$scope.fetch is never called ... seems to be unrelated to original issue. i opened a new issue:
#13743

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker bug Fixes for quality problems that affect the customer experience Feature:Visualizations Generic visualization features (in case no more specific feature label is available) PR sent v6.0.0-beta1 v6.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants