fix: extra filters for chart data endpoint#10359
Conversation
There was a problem hiding this comment.
The current logic generates an invalid filter (picked up by TS linter in superset-ui).
fc5df9a to
01473ce
Compare
| op: Array.isArray(values) ? 'IN' : '=', | ||
| val: values, | ||
| })) | ||
| .filter(filter => filter.val !== null); |
There was a problem hiding this comment.
when user clear out a filter, it's value will be null, and we need to send out this to backend.
There was a problem hiding this comment.
@graceguo-supercat when the filter is cleared, the filter will be removed, thus triggering a filter event (tested that it works properly on both legacy and new charts). Having an undefined value for a binary or set filter is also invalid according to the type declarations on superset-ui, so if this is the case we probably need to make changes there. See https://github.com/apache-superset/superset-ui/blob/97e7ba99d0efc363805a415f5f1a646f781ba1fb/packages/superset-ui-query/src/types/Query.ts#L8-L22
* fix: extra filters * fix old test and add new test * add test for null filter value * leave lowercase until all operators are fully uppercased * bump packages * rename test
This reverts commit 3c39b26.
* fix: extra filters * fix old test and add new test * add test for null filter value * leave lowercase until all operators are fully uppercased * bump packages * rename test
* fix: extra filters * fix old test and add new test * add test for null filter value * leave lowercase until all operators are fully uppercased * bump packages * rename test
* fix: extra filters * fix old test and add new test * add test for null filter value * leave lowercase until all operators are fully uppercased * bump packages * rename test

SUMMARY
Currently Filter Box events aren't being properly reflected in the new chart data endpoint requests. This was because
extra_filtersweren't being properly merged with filters from the chart data payload. The bulk of the fix was done insuperset-ui( apache-superset/superset-ui#688 ), and updates@superset-ui/chartto the most recent released version.TEST PLAN
CI + new tests.
SCREENSHOTS
Below are screenshots of a Filter Box with changing legacy charts (Name Line, Multiformat Line) and one new chart (Name Cloud, ECharts Multiformat).
BEFORE
Previously Filter Box changes (date range, time grain, gender selector) were NOT reflected in the viz' calling the new chart data endpoint (Name Cloud, ECharts Multiformat).


AFTER
As can be seen, changes in the Filter Box are reflected properly in all charts.


ADDITIONAL INFORMATION