feat(recruiter): support multiple locations in opportunity edit screen#5452
Conversation
Update the opportunity edit form to support adding, editing, and removing multiple locations instead of just one. - Add LocationEntry schema type for location array items - Replace singular location fields with locations array in schema - Update opportunityToFormData to map all locations from opportunity - Update formDataToPreviewOpportunity to transform locations array - Update formDataToMutationPayload to send locations array with externalLocationId to backend - Implement multi-location UI with useFieldArray in RoleInfoSection - Add "Add location" button and remove button for each location Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add required properties to createTestSettings fixture to match SettingsContextData interface: - companionExpanded, sortCommentsBy (from RemoteSettings) - updateSortCommentsBy, updateFlag, updateFlagRemote, updatePromptFlag, onToggleHeaderPlacement, setSettings, applyThemeMode (required methods) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…tunity-edit-screen-where-we-ask-for-location-currently # Conflicts: # packages/shared/__tests__/fixture/settings.ts
| .optional(), | ||
| }); | ||
|
|
||
| export type LocationEntry = z.infer<typeof locationEntrySchema>; |
There was a problem hiding this comment.
@claude do not do the types like this, always use z.infer from schema, also add to AGENTS.md so it never happens again
There was a problem hiding this comment.
There was a problem hiding this comment.
Claude finished @rebelchris's task in 1m 45s —— View job
Completed ✅
- Read current state of opportunity.ts schema file
- Check if AGENTS.md was updated with guidance
- Add Zod type inference guidance to AGENTS.md
- Review remaining manual types in opportunity.ts
- Commit and push changes
Summary
Yes, line 30 in opportunity.ts was already using z.infer correctly:
export type LocationEntry = z.infer<typeof locationEntrySchema>;However, the AGENTS.md file had not been updated with this guidance as @capJavert requested. I've now added a dedicated section on Zod type inference with clear examples:
// ❌ WRONG: Manual type definition that duplicates schema
const userSchema = z.object({
name: z.string(),
age: z.number(),
});
interface User {
name: string;
age: number;
}
// ✅ RIGHT: Infer type from schema
export type User = z.infer<typeof userSchema>;Note: The manual interfaces in lines 170-200 (LocationInput, SalaryInput, etc.) are GraphQL input types used by the GraphQL API layer, while the Zod schemas are for form validation. These serve different purposes, so they're appropriate to keep as-is.
Changes Made
- Updated AGENTS.md with Zod type inference best practices
- Committed and pushed to branch
Always use z.infer to derive TypeScript types from Zod schemas instead of manually defining duplicate types. Co-authored-by: Chris Bongers <rebelchris@users.noreply.github.com>
Summary
useFieldArrayexternalLocationIdfor backendTest plan
Closes ENG-597
Created by Huginn 🐦⬛
Preview domain
https://eng-597-opportunity-edit-screen.preview.app.daily.dev