Fix reprint loop on tag filters

- Fix endless loop if a tag was selected
- Tag selection is now saved, both 'selected' and 'excluded' (old state is lost though)
- Streamlined reprinting even more by refactoring bogus drilldown
This commit is contained in:
Wolfsblvt
2024-03-30 20:33:08 +01:00
parent 1ff40f0af4
commit 6fe7c1fdaf
2 changed files with 29 additions and 35 deletions

View File

@ -24,6 +24,7 @@ export const FILTER_STATES = {
EXCLUDED: { key: 'EXCLUDED', class: 'excluded' },
UNDEFINED: { key: 'UNDEFINED', class: 'undefined' },
};
export const DEFAULT_FILTER_STATE = FILTER_STATES.UNDEFINED.key;
/**
* Robust check if one state equals the other. It does not care whether it's the state key or the state value object.
@ -203,7 +204,7 @@ export class FilterHelper {
return this.filterDataByState(data, state, isFolder);
}
filterDataByState(data, state, filterFunc, { includeFolders } = {}) {
filterDataByState(data, state, filterFunc, { includeFolders = false } = {}) {
if (isFilterState(state, FILTER_STATES.SELECTED)) {
return data.filter(entity => filterFunc(entity) || (includeFolders && entity.type == 'tag'));
}