-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Canvas] Fixes filter clearing on undo/redo #31859
Conversation
Pinging @elastic/kibana-canvas |
f3393ac
to
b6edf24
Compare
💚 Build Succeeded |
// reset element.filter if element is no longer a filter | ||
if ( | ||
updatedElement.filter && | ||
!['dropdownControl', 'timefilterControl', 'exactly'].some(filter => |
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.
Is there a way we can get the list of filter elements without hard-coding them here? Maybe we can pull the functions from the registry somehow?
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.
I'd need to somehow check for render functions that specifically render filters. I don't see anything in the renderer def that I could use to single out filter renderers.
I could introduce a new property in the renderer def like subtype: filter
, but I think this should be addressed in a separate PR.
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.
Yeah, I gave this some thought too, and couldn't come up with anything simple here. I'm cool derfering on this as well, just please open an issue for 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.
I added a TODO to that line, and I'll open an issue.
This is a ton better, but there's still an edge case here that involves the advanced filter. It may be a bug in that component though, and I'm fine with deferring and opening another issue instead. Here's the edge case:
So far so good, we see the filter value we expect to see. Now:
Note that If you change the filter value and click apply, and then remove the As stated, I'm fine deferring this, |
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.
LGTM as-is, but see my comment about the edge case. If you don't want to fix it here (which is probably the right call), please open a new issue.
💔 Build Failed |
d59705d
to
9787136
Compare
💔 Build Failed |
💚 Build Succeeded |
* Added check to reset filters in 'setExpression' * Removed filter reset from filter renderers' onDestroy handler * Cleaned up setExpression * Added TODO
* Added check to reset filters in 'setExpression' * Removed filter reset from filter renderers' onDestroy handler * Cleaned up setExpression * Added TODO
* Added check to reset filters in 'setExpression' * Removed filter reset from filter renderers' onDestroy handler * Cleaned up setExpression * Added TODO
Summary
Closes #28730.
This adds a check in the
setExpression
action to clear out the filters if the expression is no longer a filter expression. This makes sure filters don't persist if you started with a filter element and changed the expression to another type of element, such asmarkdown
.This also removes the call to clear element filters from the filter element
onDestroy
handler which was clearing out the element's filter when you undo/redo or nav between workpad pages.Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] This was checked for cross-browser compatibility, including a check against IE11- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] Documentation was added for features that require explanation or tutorials- [ ] Unit or functional tests were updated or added to match the most common scenarios- [ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers