I am currently working with the Residential Comp Finder. Sort functionality is broken when a filter is applied to a feature layer in the AGOL map. Error returned as message alert: 'Unable to sort', from console: code 400, "'where' parameter is invalid"

It is broken because the query parameter to the REST endpoint is malformed. For some reason 'AND' prefixes the query string.

For example, Filter in AGOL:

Query sent when sort field is chosen: where: %20AND%20IMPROVEMENTTYPE%20%3D%20'Dwelling'