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 depends for array builder #33108

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

rhasselle-oddball
Copy link
Contributor

@rhasselle-oddball rhasselle-oddball commented Nov 19, 2024

Summary

  • Fix depends for array builder and add index property
depends: (formData, index) => ... 
  • Fix forward navigation not respecting newly updated values for all arrays

Related issue(s)

  • Link to ticket created in va.gov-team repo
    department-of-veterans-affairs/va.gov-team-forms#1800
    department-of-veterans-affairs/va.gov-team-forms#1888

Testing done

  • Unit, cypress, regression, browser

Screenshots

n/a

What areas of the site does it impact?

array builder depends.

Acceptance criteria

Quality Assurance & Testing

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Linting warnings have been addressed
  • Documentation has been updated (link to documentation *if necessary)
  • Screenshot of the developed feature is added
  • Accessibility testing has been performed

Error Handling

  • Browser console contains no warnings or errors.
  • Events are being sent to the appropriate logging solution
  • Feature/bug has a monitor built into Datadog or Grafana (if applicable)

Authentication

  • Did you login to a local build and verify all authenticated routes work as expected with a test user

Requested Feedback

(OPTIONAL) What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?

@va-vfs-bot va-vfs-bot temporarily deployed to master/1800-fix-depends-array-builder/main November 19, 2024 20:12 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/1800-fix-depends-array-builder/main November 19, 2024 21:23 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/1800-fix-depends-array-builder/main November 19, 2024 21:59 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/1800-fix-depends-array-builder/main November 20, 2024 16:24 Inactive
@rhasselle-oddball rhasselle-oddball marked this pull request as ready for review November 20, 2024 16:46
@va-vfs-bot va-vfs-bot temporarily deployed to master/1800-fix-depends-array-builder/main November 20, 2024 19:21 Inactive
mkerns1
mkerns1 previously approved these changes Nov 20, 2024
Copy link
Contributor

@mkerns1 mkerns1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! Thanks so much for adding this in!

Midge-dev
Midge-dev previously approved these changes Nov 20, 2024
powellkerry
powellkerry previously approved these changes Nov 20, 2024
ToddWebDev
ToddWebDev previously approved these changes Nov 21, 2024
Copy link
Contributor

@ToddWebDev ToddWebDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well for me!

@williamphelps13
Copy link
Contributor

williamphelps13 commented Nov 21, 2024

I switched out the onNavForward and onNavBack conditional page solution in this file, for the depends solution locally and it is working nicely!

The issue I am still encountering is that on edit if the page becomes no longer shown the data is still present. See this in the following video when "wrist fracture" triggers the sideOfBody question but then on edit when "wrist fracture" is updated to "asthma" which does not trigger the sideOfBody the sideOfBody data is still present and "asthma" is displayed as "asthma, right":

Screen.Recording.2024-11-21.at.9.00.34.AM.mov

Could be out of scope for this fix or could be I need to handle it in a different way.

Copy link
Contributor

@williamphelps13 williamphelps13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just found a potential bug. I had the page that was shown conditionally as a middle page of the loop (that is what the above video demos). With a recent request the conditional page became the last page of the loop. On the summary page I am now not able to click the "no" option and and continue on. The following video shows the conditional page as a middle page first then as the last page:

Screen.Recording.2024-11-21.at.10.13.33.AM.mov

Here is my branch with your changes merged in and the conditional page as the last in the loop (select the "Cherry" demo when in localhost): conditions-639-refine-prototypes

@Midge-dev Midge-dev dismissed stale reviews from ToddWebDev, powellkerry, mkerns1, and themself via 6c64fba November 21, 2024 19:11
@Midge-dev Midge-dev requested a review from a team as a code owner November 21, 2024 19:11
@rhasselle-oddball
Copy link
Contributor Author

Thanks @Midge-dev for helping with the tests on 686

Status update: Working on bug that @williamphelps13 found. Need to fix that before merging.

@rhasselle-oddball rhasselle-oddball force-pushed the 1800-fix-depends-array-builder branch 2 times, most recently from e87d395 to 504c78f Compare November 22, 2024 17:44
@@ -0,0 +1,289 @@
import path from 'path';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added new cypress test in latest commit.

@rhasselle-oddball rhasselle-oddball force-pushed the 1800-fix-depends-array-builder branch 2 times, most recently from c236024 to 6f43684 Compare November 25, 2024 15:04
@va-vfs-bot va-vfs-bot temporarily deployed to master/1800-fix-depends-array-builder/main November 25, 2024 15:42 Inactive
Copy link
Contributor Author

@rhasselle-oddball rhasselle-oddball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR ready for review

@@ -42,6 +42,14 @@ const testConfig = createTestConfig(
});
});
},
'veteran-identification-information': ({ afterHook }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

included this additional unrelated change - because it was blocking PR

@va-vfs-bot va-vfs-bot temporarily deployed to master/1800-fix-depends-array-builder/main November 26, 2024 01:54 Inactive
Midge-dev
Midge-dev previously approved these changes Nov 26, 2024
Copy link
Contributor

@williamphelps13 williamphelps13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous bug: when dependent page is the last page and its the last item added the user could not continue on from the list loop
This is now resolved.

Potential new issue: the recent changes appear to have changed formData to contain all formData for onNavForward when it previously only contained the itemData.

This may be an enhancement *(in the long term) because it seems desirable that formData always contain all formData and never just contain itemData. *Though in this PR it will cause regressions in some forms.

@rhasselle-oddball
Copy link
Contributor Author

Previous bug: when dependent page is the last page and its the last item added the user could not continue on from the list loop This is now resolved.

Potential new issue: the recent changes appear to have changed formData to contain all formData for onNavForward when it previously only contained the itemData.

This may be an enhancement actually because it seems desirable that formData always contain all formData and never just contain itemData.

Appreciate the thorough testing @williamphelps13 - I'll spend some more time on this, to make sure the formData discrepancies don't cause regressions in existing forms.

onNavForward: props => {
return !props.formData.currentlyServing
const item =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since onNavForward accepts different formData now, I went through the code, and updated all places that were affected

@va-vfs-bot va-vfs-bot temporarily deployed to master/1800-fix-depends-array-builder/main November 27, 2024 20:40 Inactive
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.

7 participants