-
-
Notifications
You must be signed in to change notification settings - Fork 597
Description
Is your feature request related to a problem? Please describe.
Currently, ProgramForm checks name uniqueness by making an additional query to the backend, which results in duplicate requests and duplicated validation logic. The backend already enforces uniqueness via GraphQL/database constraints, but frontend does not yet handle structured GraphQL validation errors.
const checkNameUniquenessSync = useCallback(
async (name: string): Promise<string | undefined> => {
if (!name.trim()) {
return undefined
}
try {
const { data } = await client.query({
query: GetMyProgramsDocument,
variables: { search: name.trim(), page: 1, limit: 100 },
})
const programs = data?.myPrograms?.programs || []
const duplicateProgram = programs.find(
(program: { name: string; key: string }) =>
program.name.toLowerCase() === name.trim().toLowerCase() &&
(!isEdit || program.key !== currentProgramKey)
)Describe the solution you'd like
Handle uniqueness through backend validation only and introduce GraphQL error formatting so field-level validation errors (e.g., name) can be passed via extensions and mapped directly to the form. This will remove the extra request and keep validation centralized.
Are you going to work on implementing this?
- Yes
- No
Additional context
frontend/src/components/ProgramForm.tsx
Metadata
Metadata
Assignees
Labels
Type
Projects
Status