chore(angular-react): Migrate SettingsComponent to React#8
Open
devin-ai-integration[bot] wants to merge 4 commits intomainfrom
Open
chore(angular-react): Migrate SettingsComponent to React#8devin-ai-integration[bot] wants to merge 4 commits intomainfrom
devin-ai-integration[bot] wants to merge 4 commits intomainfrom
Conversation
Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
- useState for form fields (image, username, bio, email, password), errors, isSubmitting - useEffect for ngOnInit logic (load current user on mount) - onSubmit handler for form submission with error handling - handleLogout handler for logout functionality - Controlled inputs replacing Angular reactive form bindings - JSX template converted from Angular template with existing CSS classes - TODO comments for UserService and Router dependencies Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Addresses Devin Review feedback: the useEffect had getCurrentUser in its dependency array, causing it to re-run on every parent re-render (since function props create new references). This would silently discard unsaved form edits. Added a useRef(false) guard so the effect body executes exactly once, matching Angular's ngOnInit semantics. Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
The User interface has no password field, so Partial<User> would cause
type-safe implementers to silently drop password updates. Widen the
updateUser prop type to Partial<User> & { password?: string }.
Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a React functional component (
SettingsComponent.tsx) alongside the existing AngularSettingsComponent, as part of an incremental Angular-to-React migration. The original Angular files are not modified or removed.The React component faithfully ports:
image,username,bio,email,password) viauseState, replacing Angular'sFormGroup/FormControluseEffectwith auseRefguard for mount-only execution, replacingngOnInit— loads current user and populates formisSubmittingguard and error display, replacing(ngSubmit)+takeUntilDestroyedsubscription(click)="logout()"ListErrorshelper mirroring the AngularListErrorsComponentExternal dependencies (
UserService,Router) are passed as props withTODOcomments marking where React context/hooks should replace them.Updates since last revision
useEffectmount-only initialization: added auseRef(false)guard so the effect body executes exactly once, preventing parent re-renders from resetting in-progress form edits (addresses Devin Review feedback).updateUserprop type fromPartial<User>toPartial<User> & { password?: string }so that type-safe implementers won't silently drop the password field from the API payload (addresses Devin Review feedback).Review & Testing Checklist for Human
settings.component.ts+settings.component.html) and confirm all form fields, event handlers, and control flow are faithfully ported.setErrors(err as Errors)assumes the rejected promise value matches theErrorsinterface. This mirrors the Angular code's behavior but could break at runtime if the API returns a different error shape. Consider whether a type guard or normalization is needed.requiredvalidator dropped: The Angular version hadValidators.requiredon the passwordFormControl, but the React version has no equivalent validation. Confirm this is intentional.User/Errorsinterfaces: These are copy-pasted from the Angular models rather than imported. Verify alignment with the source types and consider whether shared types are preferable once more components are migrated.Suggested test plan: Since React cannot be compiled in this project yet, the best verification is a manual side-by-side review of the Angular and React sources. Once React is added as a dependency in a future step, render the component with mock props and verify: (1) form populates from
getCurrentUser, (2) edits persist across re-renders, (3) submit callsupdateUserwith all fields including password, (4) errors display correctly, (5) logout fires the callback.Notes
bun run formatproduced no changes).reactandreact-domare not project dependencies — this is by design for this incremental migration step.zone.jsin vitest) are unrelated to this change.Link to Devin session: https://app.devin.ai/sessions/12fd2d3198254e8bbe9b9293879f09f4
Requested by: @lburgers