[Registrar - Datatable Modal] Search query filters are stacking
Expected Behavior
When the filter is cleared or changed, no old search filters are applied and the whole model is searched for the query.
Actual Behavior
When given a new search query, the filters stack on top of each other. For example, if one searches "test"
and then searches "another"
, both searchExpressions appear in the server request like:
[...]Students/[...]&$filter=(studentStatus/alternateName%20eq%20%27active%27
%20and%20
indexof(studentIdentifier,%20%27test%27)%20ge%200%20or%20indexof(person/familyName,%20%27test%27)%20ge%200%20or%20indexof(person/givenName,%20%27test%27)%20ge%200%20or%20indexof(user/name,%20%27test%27)%20ge%200%20or%20indexof(studyProgram/name,%20%27test%27)%20ge%200%20or%20indexof(studentStatus/name,%20%27test%27)%20ge%200%
20and%20
indexof(studentIdentifier,%20%27another%27)%20ge%200%20or%20indexof(person/familyName,%20%27another%27)%20ge%200%20or%20indexof(person/givenName,%20%27another%27)%20ge%200%20or%20indexof(user/name,%20%27another%27)%20ge%200%20or%20indexof(studyProgram/name,%20%27another%27)%20ge%200%20or%20indexof(studentStatus/name,%20%27another%27)%20ge%200)
%20and%20
((department%20eq%20418))
Steps to Reproduce
Select a filter from the modal and then search more than once.
The bug is not there if you never select a filter.
More Information (optional)
I suspect this has to do with using and old query and appending the filters. Specifically, I think this line is the culprit. I spent a lot of time but couldn't figure a clean way to remove only search-related filters before applying new ones.