diff --git a/src/components/global/FilterPopover/FilterRolesPopover.tsx b/src/components/global/FilterPopover/FilterRolesPopover.tsx index dc93783e..fa8f4d3d 100644 --- a/src/components/global/FilterPopover/FilterRolesPopover.tsx +++ b/src/components/global/FilterPopover/FilterRolesPopover.tsx @@ -199,15 +199,14 @@ function FilterRolesPopover({ handleSelectedRoles }: IFilterRolesPopover) { ); if (isRoleSelected) { - setFilteredRolesByName(''); return prevSelectedRoles.filter( (selectedRole) => selectedRole.id !== role.id ); } else { - setFilteredRolesByName(''); return [...prevSelectedRoles, role]; } }); + setFilteredRolesByName(''); }; const [isAutocompleteOpen, setAutocompleteOpen] = useState(false); @@ -312,6 +311,11 @@ function FilterRolesPopover({ handleSelectedRoles }: IFilterRolesPopover) { handleClearAll(); } }} + onInputChange={(event, value, reason) => { + if (reason === 'clear') { + handleClearAll(); + } + }} getOptionLabel={(option) => option.name} renderTags={(value, getTagProps) => value.map((option, index) => ( @@ -350,10 +354,6 @@ function FilterRolesPopover({ handleSelectedRoles }: IFilterRolesPopover) { placeholder="Select one or more roles" value={filteredRolesByName} onChange={handleSearchChange} - onClick={(e) => { - e.stopPropagation(); - setAutocompleteOpen(false); - }} /> )} /> diff --git a/src/context/ChannelContext.tsx b/src/context/ChannelContext.tsx index d7beb09c..e5206606 100644 --- a/src/context/ChannelContext.tsx +++ b/src/context/ChannelContext.tsx @@ -155,7 +155,7 @@ export const ChannelProvider = ({ children }: ChannelProviderProps) => { ...prevSelectedSubChannels, }; - allChannels.forEach((channel) => { + allChannels?.forEach((channel) => { const channelUpdates: { [subChannelId: string]: boolean } = {}; channel?.subChannels?.forEach((subChannel) => { diff --git a/src/store/slices/platformSlice.ts b/src/store/slices/platformSlice.ts index 164e3919..1d20b05a 100644 --- a/src/store/slices/platformSlice.ts +++ b/src/store/slices/platformSlice.ts @@ -80,9 +80,10 @@ const createPlatfromSlice: StateCreator = (set, get) => ({ params.append('property', property); - // Only append sortBy if it's not undefined if (sortBy !== undefined) { params.append('sortBy', sortBy); + } else if (property === 'role') { + params.append('sortBy', 'name:asc'); } if (name) params.append('name', name);