Skip to content

Commit

Permalink
UHF-9883: Change the school search resetForm function to reset all in…
Browse files Browse the repository at this point in the history
…dividual atoms to default state as well
  • Loading branch information
teroelonen committed Apr 12, 2024
1 parent 9248d5f commit 0c54824
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/js/school-search.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ const FeatureFormContainer = () => {

if (keyword.value && keyword.value.length) {
params.keyword = keyword.value;
};
}

[finnish_education, grades_1_6, grades_1_9, grades_7_9, swedish_education].forEach(element => {
if (!element || !element.checked || !element.name) {
return;
};
}

const name = element.name as keyof Omit<SearchParams, 'keyword'|'page'|'query'|'a1'|'a2'|'b1'|'b2'|'weighted_education'|'bilingual_education'>;
params[name] = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ProximityFormContainer = () => {

if (keyword.value && keyword.value.length) {
params.keyword = keyword.value;
};
}

setParams(params);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ const SelectionsContainer = ({ keys }: SelectionsContainerProps) => {

const resetForm = () => {
setSearchParams({});

// Reset individual selection atoms to their default states
updateA1([]);
updateA2([]);
updateB1([]);
updateB2([]);
updateWeighted([]);
updateBilingual([]);
};

const showClearButton =
Expand Down

0 comments on commit 0c54824

Please sign in to comment.