Skip to content

Commit

Permalink
fix: platform filtering in multimodule
Browse files Browse the repository at this point in the history
  • Loading branch information
berezinant committed Dec 2, 2024
1 parent 215a0f3 commit b654529
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,25 @@ declare global {
activeFilters: (string | null | undefined)[];
};

function filterSourceset(sourceset: string): void;

function unfilterSourceset(sourceset: string): void;

function refreshFiltering(): void;
function refreshSourcesetsCache(): void;
}

/**
* This syncs platform tags and dropdown options filtering behavior.
*/
function toggleFilterForOption(option: Element): void {
const dataFilter = option.querySelector('.checkbox--input')?.getAttribute('data-filter');
const index = filteringContext.activeFilters.findIndex((item) => item === dataFilter);
if (index === -1) {
filteringContext.activeFilters.push(dataFilter);
} else {
filteringContext.activeFilters.splice(index, 1);
if (dataFilter) {
const index = filteringContext.activeFilters.findIndex((item) => item === dataFilter);
if (index === -1) {
unfilterSourceset(dataFilter);
} else {
filterSourceset(dataFilter);
}
}
refreshFiltering();
refreshSourcesetsCache();
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b654529

Please sign in to comment.