department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
282 stars 202 forks source link

Unified SPA: Investigate how an another app (group), e.g. combined debt portal, were combined into to a single SPA #92626

Open wesrowe opened 1 month ago

wesrowe commented 1 month ago

Description

User story

As a Cartography team member, I want to support OCTO's exploration of the unified-portal idea, so that a decision can be made about whether to pursue it.

Notes

Possible tasks:

Acceptance criteria

dcloud commented 1 week ago

Initial thoughts/notes

As I'm looking at this, I wonder if/how merging SPAs might interact with content-build vs next-build, though I'd hope its safe to assume that the different -build repos would treat app changes the same way.

First Steps

dcloud commented 1 week ago

Further notes

From my in-progress notes

Current Structure

The src/applications/combined-debt-portal/combined/manifest.json tells us that the combined directory is the root app folder and combined-debt-portal is a path to collect the deb applications, debt-letters and medical-copays. The routes file imports from both those applications as well as from ./containers directory that has CombinedPortalApp.jsx. So the combined app both imports other apps into Routes and wraps everything in some common code.

CombinedPortalApp.jsx wraps the combined router and provides unauth redirects, downtime notifications, and service dependency checks (mvh, vbs, and dmc).

App Isolation

An entry exists in config/changed-apps-build.json where "rootFolder": "combined-debt-portal". The structure of having a rootFolder that only holds other folders, combined, debt-letters, and medical-copays (where only combined has a manifest), may be in part a way to get isolated builds working with a nested structure. The MHV apps had issues with isolation from a shared mhv folder that housed multiple apps.

dcloud commented 6 days ago

When isolating the mhv applications, we saw issues with (CI?) tools not recognizing apps under certain paths, but that doesn't appear to affect combined-debt-portal, and it appears that the fact that the manifest JSON is in a subdirectory is fine.

Hoping to satisfy my curiosity and refresh my memory around directory structuring and app isolation, I went back to look for details on the issue we saw, but couldn't find anything about the errors. I did see that moving folders out of a shared src/applications/mhv was part of the approach, so perhaps that provides some answers.

dcloud commented 6 days ago

Work on combined-debt-portal

Combined Debt Portal Epic

  1. Create new combined app (circa April 20, 2022) as a child under a new namespace dir that also serves as the name of record: combined-debt-portal. So the name of record matches the parent directory that contains the actual combined app
  2. Create a CombinedPortalApp and add redux actions for fetching data: # 39369 - [CDP] - Establish API Calls for Data to Render (circa April 25, 2022)
  3. Add "combined features", e.g. # 39372 [CDP] Your VA debts and bills Cards (circa May 6, 2022)
  4. CDP Merge medical-copays under the new combined-debt-portal #21150 (circa May 24, 2022). Note that the app was copied and src/applications/medical-copays was not removed at this time
  5. Copy debt-letters into combined-debt-portal CDP 41483 Merging Debt Letters under Combined Debt Portal #21148 (circa May 24, 2022). Note that the app was copied and src/applications/debt-letters was not removed at this time
  6. Redirects for URL changes. The combined-debt-portal changed URLs
  7. Removed debt-letter and medical-copay urls... (Dec 28, 2022) from ansible/deployment/config/revproxy-vagov/vars/react_routes.yml in devops repo"configures whether routes ignored by proxy, allowing client-side routing such as react router"
  8. Removed old debt-letters app: [CDP] - [LTR] - Remove Unused Applications #28542 (March 2024). Updates CODEOWNERS and deletes old app code
  9. Removed old medical-copays app: [CDP] - [MCP] - Remove Unused Applications #28541 (March 2024). Updates CODEOWNERS and deletes old app code
dcloud commented 6 days ago

A highlight from the above "work on" timeline is that the combined-debt-portal put the new copies of debt-letters and medical-copays at different URLs, so the migration involved redirects.

We should think through how moving applications into a mhv-unified-portal might work without changing URLS. I don't think we want to change URLs for the MHV unified SPA, so we might have a tricky path to move an app, unregister it from the content-build, etc.

dcloud commented 6 days ago

Pros

Cons

carlosfelix2 commented 4 days ago

One approach to change would be to keep the routes for each app in each app's folder and just have the unified app point to those routes. This way it will isolate the routing for each app to their own file and hopefully keep teams working in their own area.