-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fix favoriting on label select #908
Conversation
…added on selection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the bug, but let's clean this up a bit.
@matyax I cleaned up the unit test hack (mocked out the local storage functions like you suggested) and refactored a bit. If you could take another look I'd appreciate it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Co-authored-by: Matias Chomicki <[email protected]>
…thub.com/grafana/explore-logs into gtk-grafana/issues/905/favorites-fixings
Fixes: #905
Fixes: #904
Should add any label to favorites when adding any ad hoc filter in the UI except for in the combobox.
Also fixes a bug with the service selection search where a custom filter would be actively filtering the labels returned in the UI, but the search input was empty and was not able to be cleared.
Now whenever labels are added (besides directly in the combobox), that label is favorited, and pushed to the top of the dropdowns, and the top of the service list on the next render (I don't think we want to change the order of the service selection list as users are adding filters).
I wasn't happy with subscribing to the combobox and favoriting whenever something was added as we didn't have the context needed to re-render components after adding things to local storage, adding full combobox support could be solved by subscribing in the ServiceScene, and ServiceSelection scene, and avoiding the re-rendering in the ServiceScene since nothing in the UI displays the favorites.
We might want to refactor the components that consume local storage to listen to events or subscribe to some top-level state for re-rendering to get this in a more future proof state.
Need to follow up with addressing adding combobox filters to favorites in another PR