Skip to content

Commit

Permalink
Merge pull request #1399 from fedspendingtransparency/FDG-9594-Add-Mo…
Browse files Browse the repository at this point in the history
…nth-and-year-Filters

FDG-9594 Fix text filtering
  • Loading branch information
wyattch authored Sep 24, 2024
2 parents 1946192 + 897b04a commit 4bfacab
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,23 @@ const ComboSelectDropdown = ({
const filterOptionsByEntry = (opts, entry) => {
let filteredList = [];
if (entry?.length && !hasChildren) {
filteredList = opts.filter(opt => opt[optionLabelKey].toUpperCase().includes(entry.toUpperCase()));
filteredList = opts.filter(opt =>
opt[optionLabelKey]
.toString()
.toUpperCase()
.includes(entry.toUpperCase())
);
setNoResults(filteredList.length === 0);
} else if (hasChildren) {
let sectionResults;
let allResultsLength = 0;
opts.forEach(section => {
sectionResults = section.children.filter(opt => opt[optionLabelKey].toUpperCase().includes(entry.toUpperCase()));
sectionResults = section.children.filter(opt =>
opt[optionLabelKey]
.toString()
.toUpperCase()
.includes(entry.toUpperCase())
);
allResultsLength += sectionResults.length;
filteredList.push({ label: section.label, children: sectionResults });
});
Expand Down

0 comments on commit 4bfacab

Please sign in to comment.