diff --git a/src/UserSearchContainer.js b/src/UserSearchContainer.js index 2a799b3..6689ac8 100644 --- a/src/UserSearchContainer.js +++ b/src/UserSearchContainer.js @@ -40,8 +40,8 @@ const compileQuery = template( ); export function buildQuery(queryParams, pathComponents, resourceData, logger, props) { - const filters = props.initialSelectedUsers ? filterConfigWithUserAssignedStatus : filterConfig; - const updatedResourceData = props.initialSelectedUsers && resourceData?.query?.filters?.includes(UAS) ? updateResourceData(resourceData) : resourceData; + const filters = Object.keys(props.initialSelectedUsers).length ? filterConfigWithUserAssignedStatus : filterConfig; + const updatedResourceData = Object.keys(props.initialSelectedUsers).length && resourceData?.query?.filters?.includes(UAS) ? updateResourceData(resourceData) : resourceData; return makeQueryFunction( 'cql.allRecords=1', diff --git a/src/UserSearchView.js b/src/UserSearchView.js index ebbdc07..30905e7 100644 --- a/src/UserSearchView.js +++ b/src/UserSearchView.js @@ -174,7 +174,7 @@ class UserSearchView extends React.Component { isSelected = ({ item }) => Boolean(this.state.checkedMap[item.id]); getFilterConfig = () => { - if (this.props.initialSelectedUsers) { + if (Object.keys(this.props.initialSelectedUsers).length) { return filterConfigWithUserAssignedStatus; } return filterConfig;