-
Notifications
You must be signed in to change notification settings - Fork 84
Properly use PrivacyRequestResponse type #6912
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
Properly use PrivacyRequestResponse type #6912
Conversation
…-request-manager-filters
…-request-manager-filters
…-request-manager-filters
…rivacy-request-list-endpoints-models
…rivacy-request-list-endpoints-models
…rivacy-request-list-endpoints-models
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
…PrivacyRequestEntity-with-true-PrivacyRequestResponse-model-Update-depracated-endpoint
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.
Greptile Overview
Greptile Summary
This PR migrates the privacy request manager screen from using the disconnected PrivacyRequestEntity type to the OpenAPI-generated PrivacyRequestResponse type. This improves type safety and ensures the frontend stays in sync with the backend API contract.
Key changes:
- Updated
PrivacyRequestResponsetype with new fields:identitynow supports both legacy string format and newIdentityValueobject format, addedlocationandduplicate_request_group_idfields - Added backward compatibility layer in
utils.tsto handle both legacy string identities and new object-based identities - Applied proper null/undefined handling throughout components using optional chaining and null guards
- Updated all components and hooks to use
PrivacyRequestResponseinstead ofPrivacyRequestEntity - Added comprehensive test coverage for the utility functions handling identity and custom fields
- Created new
ItemActionscomponent for better code organization
Manual type override:
The custom_privacy_request_fields property has a manual type override (commented in code) because the auto-generated type is currently null. This is tracked for future resolution in ENG-1859.
Confidence Score: 5/5
- This PR is safe to merge - it's a well-executed type migration with proper backward compatibility
- The changes are thorough and well-tested with comprehensive null handling, backward compatibility for legacy formats, updated test coverage, and proper optional chaining throughout. The manual type override is documented and tracked for future resolution.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| clients/admin-ui/src/types/api/models/PrivacyRequestResponse.ts | 5/5 | Updated type with new fields (identity now supports IdentityValue, location, duplicate_request_group_id) and manual override for custom_privacy_request_fields |
| clients/admin-ui/src/features/privacy-requests/dashboard/utils.ts | 5/5 | Added backward compatibility for legacy string identities and proper null/empty handling with lodash isEmpty |
| clients/admin-ui/src/features/privacy-requests/dashboard/list-item/components/Header.tsx | 5/5 | Updated to use PrivacyRequestResponse type and added optional chaining for policy.rules |
27 files reviewed, no comments
|
@jpople fyi this is ready for review now. pr size fails for file changes count, I expect this to be a common occurance with typescript updates. |
| daysLeft: number | undefined; | ||
| timeframe: number | undefined; | ||
| daysLeft: number | undefined | null; | ||
| timeframe: number | undefined | null; |
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.
I know this is outside the scope of this PR but we've gotta figure something out about all these undefined | nulls, they're so unpleasant.
jpople
left a comment
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.
Code changes look sound, and I clicked around in the privacy request screen on my local and everything is working for me.
Ticket ENG-1830
Description Of Changes
This PR addresses the following issues:
Note: There is currently still one property that required a manual override (it's commented in the code). The autogenerated type for that one is null. This will be fixed in a followup issue, possibly the migration to a new ts generation library (ENG-1859) could fix it.
Code Changes
Steps to Confirm
Regression testing old/current request manger
Regression testing
Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works