refactor: password editing [ENG-2430]#7357
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
8c6cdad to
06cd030
Compare
Greptile OverviewGreptile SummaryThis PR updates the shared Formik Main concern is the new local Confidence Score: 2/5
Important Files Changed
|
| const [, meta, { setValue }] = useField(props.name ?? ""); | ||
| const [type, setType] = useState<"text" | "password">( | ||
| isPassword ? "password" : "text", | ||
| ); | ||
| const [disabled, setDisabled] = useState( | ||
| isDisabled || (isPassword && !!meta.initialValue && !meta.touched), | ||
| ); |
There was a problem hiding this comment.
Disabled state gets stuck
disabled is initialized from isDisabled/Formik meta once, but never updated if isDisabled changes or if Formik reinitializes (e.g., editing a different monitor/config). This will leave the input enabled/disabled incorrectly. Consider deriving disabled from current props/meta each render, or add an effect to resync when isDisabled, meta.initialValue, or meta.touched change.
| const [, meta, { setValue }] = useField(props.name ?? ""); | ||
| const [type, setType] = useState<"text" | "password">( | ||
| isPassword ? "password" : "text", | ||
| ); |
There was a problem hiding this comment.
Formik field name can be empty
useField(props.name ?? "") will bind this input to an empty field name when name is missing, which can cause Formik state collisions/unexpected updates. If TextInput can be used without a name, it should avoid calling useField (or require name when isPassword uses the edit flow).
06cd030 to
07c46ce
Compare
249ab2f to
4d1eb7c
Compare
4d1eb7c to
3f2723e
Compare
chore: update changelog refactor: refine to allow password reset fix: sync disabled conditionally fix: test edit fix: remove formik hook from input into custominput
3f2723e to
ad2d5b0
Compare
jpople
left a comment
There was a problem hiding this comment.
Tested locally, working for me. Nice change, this feels much better than what we were doing before.
Ticket ENG-2430
Description Of Changes
Adding a new password editing flow to reduce confusion when clicking the 'show' icon for editable passwords.
Code Changes
inputs.tsxto include neweditbutton flow.Steps to Confirm
Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works