Skip to content
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

[Checkbox] Should use React.forwardRef to propagate input refs #316

Open
meissadia opened this issue Feb 29, 2024 · 0 comments
Open

[Checkbox] Should use React.forwardRef to propagate input refs #316

meissadia opened this issue Feb 29, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@meissadia
Copy link
Contributor

meissadia commented Feb 29, 2024

While integrating with react-hook-form we encountered this error. Side effects include:

  • Form state does not automatically reflect changes to field

Current behavior

  • Takes inputRef as a direct prop

Expected behavior

  • Forwards ref to underlying <input>

Screenshots

Screenshot 2024-02-28 at 5 05 36 PM
@meissadia meissadia added the bug Something isn't working label Feb 29, 2024
@meissadia meissadia self-assigned this Feb 29, 2024
meissadia added a commit to cfpb/sbl-frontend that referenced this issue Mar 20, 2024
Part 3 of #222 

<img width="1226" alt="Screenshot 2024-02-29 at 4 05 55 PM"
src="https://github.com/cfpb/sbl-frontend/assets/2592907/9dd7c191-a102-44ff-9709-3758d9e72f5b">


## Changes

- Formats form data for email submission
- Triggers Mail API call upon submission
- Replace "Simulated" submission with actual Mail API call

## Planned improvements
- [ ] Data submission (formatFinancialProfileObject): Do further
comparison against `defaultValues` to determine which data was changed,
so that we only send SBL Help the info they actually need to update.
This may also be resolved if we can address the [`forwardRef`
errors](cfpb/design-system-react#316) we've
been seeing, which may fix the issue of changes to these fields not
being registered in `react-hook-form`

## How to test this PR

1. In `console` ensure routing is enabled: `setIsRoutingEnabled(true)`
1. Login as a user with an associated institution
2. Click on the Institution to `View institution profile`
3. Click on `Update institution profile`
4. Change some Institution data
5. Hit submit
6. Hopefully an email gets generated 🤞🏾 
7. In `console`, you should also see the data that will be sent. 
<img width="549" alt="Screenshot 2024-02-28 at 5 41 29 PM"
src="https://github.com/cfpb/sbl-frontend/assets/2592907/f0515aae-b02b-473c-88b3-4a7a9a881536">

## Notes
- Submission data format (decoded)
``` decoded
{
     "tax_id": "tax_id",
     "rssd_id": "rss_id",
     "parent_legal_name": "parent-name",
     "parent_lei": "parent_lei",
     "parent_rssd_id": "parent-rssd",
     "top_holder_legal_name": "top-name",
     "top_holder_lei": "top-lei",
     "top_holder_rssd_id": "top-rssd",
     "sbl_institution_types": "bankSavings,minorityDepository,other",
     "sbl_institution_types_other": "Test SBL Type",
     "additional_details": "details"
}
```
- Submission data format (encoded)
```
tax_id=tax_id&rssd_id=rss_id&parent_legal_name=parent-name&parent_lei=parent_lei&parent_rssd_id=parent-rssd&top_holder_legal_name=top-name&top_holder_lei=top-lei&top_holder_rssd_id=top-rssd&sbl_institution_types=bankSavings%2CminorityDepository%2Cother&sbl_institution_types_other=Test+SBL+Type&additional_details=details
```

---------

Co-authored-by: shindigira <shindigira@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant