-
Notifications
You must be signed in to change notification settings - Fork 4
fix: Upgrade @gusto/embeded-api to 0.10.0 #749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR upgrades the embedded API package and introduces a type-safe helper to handle the null/undefined mismatch between API responses and request payloads. The API returns null for missing values but expects undefined in mutations.
- Added
nullToUndefinedhelper with recursive type transformation - Updated employee compensation transformations to use the helper
- Upgraded
@gusto/embedded-apifrom 0.8.1 to 0.10.0
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/helpers/nullToUndefined.ts | New recursive helper that converts null to undefined in objects and arrays |
| src/helpers/nullToUndefined.test.ts | Comprehensive test suite with 11 test cases covering edge cases |
| src/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.tsx | Applied helper to employee compensation transformation |
| src/components/Payroll/PayrollConfiguration/PayrollConfiguration.tsx | Applied helper to payroll configuration compensation transformation |
| package.json | Updated embedded API dependency version |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ...compensation | ||
| }: PayrollEmployeeCompensationsType): PayrollUpdateEmployeeCompensations => { | ||
| return { | ||
| return nullToUndefined({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@serikjensen I really don't like that I did this, but maybe we chat about it in parking lot because I also have API questions that the team might know.
Basically, Cursor, is worried that we have a type mismatch between getting nulls from our server, and it wanting to take a type or undefined back.
So this is converting nulls we get from the API here to undefined.
I don't love it
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring alerts on:
|
|
@SocketSecurity ignore npm/typescript@5.9.3 |
3317e9e to
2c8d9a9
Compare
- Created nullToUndefined helper that recursively converts null to undefined - Updated PayrollEditEmployee and PayrollConfiguration to use the helper - Fixes type mismatch between API responses (null) and requests (undefined) - Added comprehensive test coverage (11 tests) - Upgraded @gusto/embedded-api from 0.8.1 to 0.10.0 - All tests, linting, and build passing
c085bc9 to
603d2aa
Compare
This reverts commit 714b753.
Summary
Upgrades us to a current default API version. Also adds a helper function to handle type transformation between API responses (which use
null) and request payloads (which expectundefined).Context
The embedded API returns
nullfor missing/empty values in responses, but expectsundefinedin request payloads. This mismatch causes TypeScript errors when passing response data directly to update mutations.Changes
nullToUndefinedhelper that recursively convertsnull→undefinedPayrollEditEmployeeto use helper for transformationPayrollConfigurationto use helper for transformationTesting