Skip to content

Commit

Permalink
feat: Persist identity search type (#4729)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg authored Oct 15, 2024
1 parent 8825971 commit 08cdf67
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions frontend/web/components/pages/UsersPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, useState } from 'react'
import React, { FC, useEffect, useState } from 'react'
import { RouterChildContext } from 'react-router'
import { Link } from 'react-router-dom'
import { useHasPermission } from 'common/providers/Permission'
Expand Down Expand Up @@ -90,10 +90,18 @@ const UsersPage: FC<UsersPageType> = (props) => {
},
)
const isEdge = Utils.getIsEdge()
const [searchType, setSearchType] = useState<'id' | 'alias'>('id')

const showAliases = isEdge && Utils.getFlagsmithHasFeature('identity_aliases')

const [searchType, setSearchType] = useState<'id' | 'alias'>(
showAliases
? localStorage.getItem('identity_search_type') === 'alias'
? 'alias'
: 'id' || 'id'
: 'id',
)
useEffect(() => {
localStorage.setItem('identity_search_type', searchType)
}, [searchType])
const { data: identities, isLoading } = useGetIdentitiesQuery({
dashboard_alias: searchType === 'alias' ? search?.toLowerCase() : undefined,
environmentId: props.match.params.environmentId,
Expand Down

0 comments on commit 08cdf67

Please sign in to comment.