Skip to content

Commit

Permalink
refactor: rename useHasFieldValue to useIsFieldValueUnique
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammer5 committed Oct 30, 2023
1 parent acb4010 commit a3a4135
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/pages/dataElements/form/fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import { AGGREGATION_TYPE, DOMAIN_TYPE, VALUE_TYPE } from '../../../constants'
import { useSchemas } from '../../../lib'
import classes from './customFields.module.css'
import { EditableFieldWrapper } from './EditableFieldWrapper'
import { useHasFieldValue } from './useHasFieldValue'
import { useIsFieldValueUnique } from './useIsFieldValueUnique'

export function NameField() {
const {
loading,
fetching,
refetch: checkIsValueTaken,
} = useHasFieldValue('name')
} = useIsFieldValueUnique('name')

return (
<FieldRFF
Expand All @@ -56,7 +56,7 @@ export function ShortNameField() {
loading,
fetching,
refetch: checkIsValueTaken,
} = useHasFieldValue('shortName')
} = useIsFieldValueUnique('shortName')

return (
<FieldRFF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface QueryResponse {
}
}

export function useHasFieldValue(field: string) {
export function useIsFieldValueUnique(field: string) {
const queryResult = useDataQuery<QueryResponse>(HAS_FIELD_VALUE_QUERY, {
lazy: true,
variables: { field, value: '' },
Expand Down

0 comments on commit a3a4135

Please sign in to comment.