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

VAGOV-TEAM-90731: add ombinfo prop #31788

Merged
merged 20 commits into from
Sep 13, 2024
Merged

VAGOV-TEAM-90731: add ombinfo prop #31788

merged 20 commits into from
Sep 13, 2024

Conversation

derekhouck
Copy link
Contributor

@derekhouck derekhouck commented Sep 5, 2024

Are you removing, renaming or moving a folder in this PR?

  • No, I'm not changing any folders (skip to Summary and delete the rest of this section)
  • Yes, I'm removing, renaming or moving a folder

Summary

Related issue(s)

Testing done

  • New unit tests for the ombInfo action and reducer.
  • New unit tests for the app's new root reducer.
  • New unit tests for the IntroductionPage container.
  • Updated tests for the form-load reducer and the App container.
  • Local testing using mock data.

Screenshots

Local host rendering a mock form with dynamic OMB Info data:
Screenshot 2024-09-05 at 2 26 23 PM

What areas of the site does it impact?

This PR only touches the form-renderer application, which is not yet live.

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

Due to our use of createRoutesWithSaveInProgress to create our child routes, I could not easily pass along data outside of formConfig to the IntroductionPage component as props. Instead, I loaded it into our Redux store and pulled from that. This is relevant to future work, as we will eventually want to customize both IntroductionPage and ConfirmationPage more thoroughly on a per-form basis. Neither of these components required access to the Redux store before this PR, so continuing on in this direction will make both components more complex.

@va-vfs-bot va-vfs-bot temporarily deployed to master/90731-add-ombinfo-prop/main September 5, 2024 17:06 Inactive
@derekhouck derekhouck marked this pull request as ready for review September 5, 2024 19:40
@derekhouck derekhouck requested a review from a team as a code owner September 5, 2024 19:40
@va-vfs-bot va-vfs-bot temporarily deployed to master/90731-add-ombinfo-prop/main September 5, 2024 19:43 Inactive
Copy link
Contributor

@ryguyk ryguyk left a comment

Choose a reason for hiding this comment

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

First off, beautiful code. This is really well written, organized, etc.

I wonder, though, if this code is implementing the cleanest approach. It feels a bit odd to me to treat the loading (and storage via Redux) of the OMB info in a manner that is isolated from the rest of the form data that is loaded and subsequently converted into a formConfig object.

This code snippet, specifically, feels like it should already be doing what we want to do:

// src/applications/form-renderer/utils/formConfig.js (before)

const formConfig = createFormConfig(form);

dispatch(formLoadingSucceeded(formConfig));

It feels odd to have to also call a dispatch for OMB-specific info:

// src/applications/form-renderer/utils/formConfig.js (proposed change)

const formConfig = createFormConfig(form);

dispatch(ombInfoLoaded(form.ombInfo));
dispatch(formLoadingSucceeded(formConfig));

It'd be great if the formConfig object would already encapsulate the needed OMB info so that we wouldn't need to introduce it separately on the Redux store. I think we can do that:

// src/applications/form-renderer/utils/formConfig.js (createFormConfig function)
return {
    ...
    introduction: props => (
      <IntroductionPage {...props} ombInfo={ombInfo} />
    ),
    ...
}

If we need to abstract this behavior for reuse, we could create a higher-order component:

const withProps = (WrappedComponent, additionalProps) => {
    return (props) => <WrappedComponent {...props} {...additionalProps} />;
};

I'm certainly open to other thoughts on this. Perhaps we can discuss.

Comment on lines 54 to 55
formLoad: reducer.formLoad,
ombInfo: reducer.ombInfo,
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels odd to me. See more general discussion.

TL;DR it seems like loading OMB info should be part of loading the other form data.

Comment on lines 65 to 64
dispatch(ombInfoLoaded(form.ombInfo));
dispatch(formLoadingSucceeded(formConfig));
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, see more general discussion. It feels a bit odd to have the OMB data treated separately from the rest of the form data.

@derekhouck
Copy link
Contributor Author

// src/applications/form-renderer/utils/formConfig.js (createFormConfig function)
return {
    ...
    introduction: props => (
      <IntroductionPage {...props} ombInfo={ombInfo} />
    ),
    ...
}

@va-vfs-bot va-vfs-bot temporarily deployed to master/90731-add-ombinfo-prop/main September 9, 2024 14:38 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/90731-add-ombinfo-prop/main September 9, 2024 16:39 Inactive
ryguyk
ryguyk previously approved these changes Sep 11, 2024
Copy link
Contributor

@ryguyk ryguyk left a comment

Choose a reason for hiding this comment

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

Nice work!

@ryguyk
Copy link
Contributor

ryguyk commented Sep 11, 2024

I approved, but I did add two small comments after doing so. I don't consider them significant enough to block approval, but they are worth considering, perhaps.

@ryguyk ryguyk merged commit 6e542fe into main Sep 13, 2024
57 of 58 checks passed
@ryguyk ryguyk deleted the 90731-add-ombinfo-prop branch September 13, 2024 23:18
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.

3 participants