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

fix: select: populate selected options text on component render #904

Closed

Conversation

sprajapati-eightfold
Copy link
Contributor

@sprajapati-eightfold sprajapati-eightfold commented Nov 8, 2024

SUMMARY:

The selectedOptionText inside the Select component was not setting when we are opening a HookForm in edit mode with pre-filled values.
Screenshot 2024-11-08 at 18 24 07

Reason: Currently, the selectedOptionText is only calculated at render + when selected options changes. But in case of HookForm with initialValues, we use the hook_form's setValue method to pass on the initial value to SelectField which updates the options prop inside octuple's Select component.

GITHUB ISSUE (Open Source Contributors)

JIRA TASK (Eightfold Employees Only):

https://eightfoldai.atlassian.net/browse/ENG-116130

CHANGE TYPE:

  • Bugfix Pull Request
  • Feature Pull Request

TEST COVERAGE:

  • Tests for this change already exist
  • I have added unittests for this change

TEST PLAN:

  1. Login as a pcs candidate /candidate/login?domain=eightfolddemo-pcsx-demo.com (sprajapati+demo4@eightfold.ai / Welcome@1)
  2. Go to Forms Center dashboard: /careers/forms/center?domain=eightfolddemo-pcsx-demo.com&customredirect=1&tab=expense
  3. Click on Edit on any existing form request. Verify that the Category and Currency fields are pre-filled. Reload the page and verify again.

Copy link

codesandbox-ci bot commented Nov 8, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.66%. Comparing base (34a3a08) to head (66a2bf3).
Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #904      +/-   ##
==========================================
- Coverage   84.66%   84.66%   -0.01%     
==========================================
  Files        1099     1099              
  Lines       20422    20423       +1     
  Branches     7720     7720              
==========================================
  Hits        17291    17291              
- Misses       3044     3045       +1     
  Partials       87       87              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant