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

Refactor forms-system onBack, routing, BackLink #34118

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

Conversation

rhasselle-oddball
Copy link
Contributor

Summary

  • Refactor FormPage's onBack so that it can be used in multiple places
  • Update BackLink (only used in a few places currently) to use onBack and va-link
  • Fix cyclical dependency
  • Fix broken css

Related issue(s)

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

Testing done

  • unit, browser, regression.
  • Test on /supporting-forms-for-claims/statement-to-support-claim-form-21-4138 which uses BackLink
  • Test on /mock-form-minimal-header/ with array builder (not committed yet)

Screenshots

image

What areas of the site does it impact?

(Describe what parts of the site are impacted if code touched other areas)

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?

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.

dev notes

@@ -1,4 +1,4 @@
import { createRoutes } from 'platform/forms-system/src/js/routing';
import { createRoutes } from 'platform/forms-system/src/js/routing/createRoutes';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was a cyclical dependency here, so just did some refactoring (should be no change)

@@ -14,58 +13,68 @@ import { setData as setDataAction } from '../actions';
* ```jsx
* <BackLink />
* ```
*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this code only affects forms using useTopBackLink property in their form config, which is 3 forms currently:

  • mhv-supply-reordering
  • 21-4138
  • mock-form-minimal-header

None of these are currently enabled on prod.

@@ -0,0 +1,68 @@
import { createFormPageList, createPageList } from '../helpers';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be no change here. just moved this function from the above routing.js to remove the cyclical dependency with FormPage

);
}

export function goBack({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this function and the below function is new. the code above this was just migrated from routing.js

router,
setData,
}) {
const path = getPreviousPagePath(pageList, formData, location.pathname);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this code should match exactly what was in FormPage onBack. Extracted so that other places besides FormPage could use this too.

@@ -640,11 +640,11 @@ va-accordion-item[data-unviewed-pages="true"] {
}

.schemaform-confirmation-section-header {
font-size: $h3-font-size;
font-size: $font-size-h3;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these specific css props seemed to have broke recently. this fixes it.

@rhasselle-oddball rhasselle-oddball marked this pull request as ready for review January 16, 2025 16:57
@rhasselle-oddball rhasselle-oddball requested review from a team as code owners January 16, 2025 16:57
Copy link
Contributor

@longmd longmd left a comment

Choose a reason for hiding this comment

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

Looks good with regards to the 10-10 work. 🚀

Copy link
Contributor

@pennja pennja left a comment

Choose a reason for hiding this comment

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

Looks great! Good work. 👍

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.

5 participants