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

Implement data.query service observables to track state changes #57168

Closed
3 of 6 tasks
lizozom opened this issue Feb 9, 2020 · 2 comments
Closed
3 of 6 tasks

Implement data.query service observables to track state changes #57168

lizozom opened this issue Feb 9, 2020 · 2 comments

Comments

@lizozom
Copy link
Contributor

lizozom commented Feb 9, 2020

Add unified state change observables to query service, to replace existing callbacks (ATM we use a mix of observables for filters and timefilter and refresh interval and callbacks for query and saved query.

data.query.getStateChanged$() will trigger when time, filters, query, auto-refresh or saved query values change, with an object with the full current state.
Note: this doesn't necessarily mean data has to be re-fetched. For example, changing a disabled filter or stopping automatic refresh.

data.query.getFetch$() will trigger when a setting that requires fetching data changes. It should also trigger when a user clicks on the refresh button, without any state changes.

So a common application pattern would be:

<data.ui.SearchBar 
   appName="MyApp"
   query="initialQuery"
   filters="initialFilters"
   savedQueryId="initialSavedQueryId"
/>

....

data.query.getStateChanges$().subscribe(() => {
    // Update state
});

data.query.getFetch$().subscribe(() => {
    // Fetch data
});

Tasks

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@Dosant
Copy link
Contributor

Dosant commented Feb 14, 2020

I also opened this one before which is related: #56503
The difference is, that in the moment we have to have helpers which observe separately for things that fall into AppState and into GlobalState

I actually started addressing that in https://github.com/elastic/kibana/pull/56128/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants