Handle un-mappable filters more gracefully #13916
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@lukasolson I started to tackle #7767 on low fruit friday but I'd like your opinion on how we should handle it. These "invisible filters" occur when the mapping chain throws an error. If a single filter throws an error, the entire chain rejects. As a result, not even the valid filters appear in the filter bar because they never get added to the scope.
So far in this PR I've changed the mapping chain to include the un-mappable filters in the result instead of rejecting, with the error assigned as a meta property. I'm thinking we can look for this meta property in the filter bar and filter editor code and display something helpful for the user.
Right now the pill for an un-mappable filter has a blank key/value:
If you click the edit button, you get the ace editor with the correct DSL:
So here's where I'm a little uncertain what to do. I don't know how to convey what's going on to the user in a way that will make sense. The filter isn't "invalid" exactly, because it's still affecting the search results just fine. We just can't map it, in this case because the filter's index doesn't exist. But we can't say "hey this filter's index doesn't exist" because we don't expose the index to the user so it'll make no sense. Maybe we should add the index as a user editable property next to the label input? What do you think?
I considered simply deleting the invalid filter, but there were a few problems with that.