Closed FaidJalal19 closed 1 month ago
Hey @FaidJalal19! I'm here to assist you with any bugs, questions, or contributions. Let's tackle this together!
Native filters applied using preselect_filters
or native_filters
in the URL might not take effect in the subsequent dashboard due to several potential issues in the encoding, decoding, or application process of these filters.
The getDashboardUrl
function is responsible for encoding these filters into the URL. If there is an issue in this function or in how the dashboard interprets these URL parameters, the filters may not be applied as expected. For example, the test case:
it('should process native filters key', () => {
const windowSpy = jest.spyOn(window, 'window', 'get');
windowSpy.mockImplementation(() => ({
location: {
origin: 'https://localhost',
search:
'?preselect_filters=%7B%7D&native_filters_key=024380498jdkjf-2094838',
},
}));
const urlWithNativeFilters = getDashboardUrl({
pathname: 'path',
});
expect(urlWithNativeFilters).toBe(
'path?preselect_filters=%7B%7D&native_filters_key=024380498jdkjf-2094838',
);
windowSpy.mockRestore();
});
This test case shows that the native_filters_key
is being processed and included in the URL. However, if the subsequent dashboard does not correctly interpret this key or the preselect_filters
parameter, the filters will not be applied [1].
Additionally, the useFilters
and useNativeFiltersDataMask
hooks in the FilterBar
state management are responsible for handling the preselected and native filters. The useFilters
hook combines the preselected filters with the native filters, while the useNativeFiltersDataMask
hook filters and reduces the data mask state to include only native filters. If these hooks are not correctly processing the filters, it could also lead to the filters not being applied as expected [2][3].
Moreover, the useFilterConfiguration
and useFilterConfigMap
functions are used to retrieve and map the dashboard's filter configuration. If these functions do not correctly retrieve or map the filters, it could result in the filters not being applied. The useIsFilterInScope
and useSelectFiltersInScope
functions determine whether filters are in scope based on the active tabs and the dashboard layout. If these functions do not correctly determine the scope of the filters, it could also lead to the filters not being applied [2][3].
To continue talking to Dosu, mention @dosu.
Bug description
I choose a set of native filters and use either
preselect_filters
ornative_filters
in the URL to have them automatically applied in the subsequent dashboard. However, they do not appear to take effect.How to reproduce the bug
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist