Skip to content

Persist user answers on Continue#255

Merged
Andrew-Folga merged 16 commits intomainfrom
TGC-821-implement-backend-api-client-as-cache-provider
Sep 15, 2025
Merged

Persist user answers on Continue#255
Andrew-Folga merged 16 commits intomainfrom
TGC-821-implement-backend-api-client-as-cache-provider

Conversation

@Andrew-Folga
Copy link
Copy Markdown
Contributor

@Andrew-Folga Andrew-Folga commented Sep 2, 2025

Integrate backend persistence for application answers via StatePersistenceService

Description:

This PR introduces StatePersistenceService, which handles saving and retrieving users’ application answers. Application state is now persisted to grants-ui-backend (MongoDB) whenever users click Continue, ensuring progress is not lost between sessions.

Changes:

  • Added StatePersistenceService to manage state lifecycle.
  • Removed the legacy “Save and Return” button from the UI.
  • Deprecated use of Redis for GrantsUI state management.
  • Updated helpers and services to support backend-driven persistence.

Acceptance Criteria:

  • When a user answers one or more questions and selects Continue, their responses are persisted in MongoDB.
  • Previously saved answers are automatically reloaded when a user returns to their application.

Notes:

  • MongoDB (via grants-ui-backend) is now the single source of truth for application state.
  • Frontend no longer depends on Redis for state management.

Testing:

  • Verified persistence to MongoDB occurs on Continue.
  • Confirmed previously answered questions load correctly when revisiting.
  • Validated removal of the “Save and Return” button.

@Andrew-Folga Andrew-Folga marked this pull request as draft September 2, 2025 12:24
Comment thread src/server/common/helpers/session-cache/backend-catbox-client.js Outdated
Comment thread src/server/common/helpers/session-cache/backend-catbox-client.js Outdated
@alanplatt
Copy link
Copy Markdown
Contributor

Looks good, my only issue it that we should look to set the ttl to not expire if we're going to handle this in the backend so we're not doing it in two places.

@Andrew-Folga
Copy link
Copy Markdown
Contributor Author

Actually I managed to remove stored and ttl alltogether as not needed.

ScenarioFactory
ScenarioFactory previously approved these changes Sep 2, 2025
ScenarioFactory
ScenarioFactory previously approved these changes Sep 3, 2025
@Andrew-Folga Andrew-Folga force-pushed the TGC-821-implement-backend-api-client-as-cache-provider branch from 84f98fe to e26809b Compare September 4, 2025 09:08
@Andrew-Folga Andrew-Folga force-pushed the TGC-821-implement-backend-api-client-as-cache-provider branch 3 times, most recently from eaa3647 to e01e2ca Compare September 10, 2025 14:08
@Andrew-Folga Andrew-Folga marked this pull request as ready for review September 11, 2025 14:05
@Andrew-Folga Andrew-Folga force-pushed the TGC-821-implement-backend-api-client-as-cache-provider branch from c1d7ff3 to 0187669 Compare September 11, 2025 14:27
@alanplatt
Copy link
Copy Markdown
Contributor

Why call clearState at all now from the confirmation controller?

Comment thread src/server/common/services/state-persistence/state-persistence.service.js Outdated
Comment thread src/config/config.js Outdated
@Andrew-Folga
Copy link
Copy Markdown
Contributor Author

Andrew-Folga commented Sep 12, 2025

Hey @alanplatt re calling clearState in confirmation controller - do we want to remove it or rather keep it in for the follow up story to mark/flag the application as submitted; btw the story talks nothing about submission hmm

@Andrew-Folga Andrew-Folga force-pushed the TGC-821-implement-backend-api-client-as-cache-provider branch from 88913f3 to 3d224c0 Compare September 12, 2025 12:19
@sonarqubecloud
Copy link
Copy Markdown

@Andrew-Folga Andrew-Folga merged commit f37a536 into main Sep 15, 2025
6 checks passed
@Andrew-Folga Andrew-Folga deleted the TGC-821-implement-backend-api-client-as-cache-provider branch September 15, 2025 10:39
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