Northeastern-Electric-Racing / Northeastern-Electric-Racing/FinishLine
[Maintenance] - Fix teamTypeId Incoming as Empty String
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 36
- Forks
- 9
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 11
Description
Description
This error stems from teamTypeId in the EventModal.tsx form data defaulting to an empty string and being allowed to proceed to the API. When it gets to the API it errors because there is no teamTypeId with a value of empty string.
Acceptance Criteria
- Add a guard to make sure that data.teamTypeId can never be an empty string
Proposed Solution
Within EventModal.tsx:
In buildPayload, only include teamTypeId when relevant, and normalize empty string to undefined.
In handleEventTypeChange, clear the fields that aren't relevant to the newly selected type... Something like:
if (!newEventType?.teamType) setValue('teamTypeId', undefined);
if (!newEventType?.location) setValue('location', undefined);
if (!newEventType?.shop) setValue('shopIds', []);
if (!newEventType?.machinery) setValue('machineryIds', []);
if (!newEventType?.workPackage) setValue('workPackageIds', []);
Mocks
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in EventModal.tsx, focusing on buildPayload and handleEventTypeChange. Trace how teamTypeId moves from form data to the API, then ensure an empty string is never included and irrelevant fields are cleared when the event type changes. Done means the payload omits teamTypeId when it is not applicable and no longer sends an empty string.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100