cds-snc / platform-forms-client

NextJS application that serves the public-facing website for Forms
https://forms-staging.cdssandbox.xyz/
MIT License
35 stars 13 forks source link

fix: Refresh Downloaded tab after confirm #4632

Closed dsamojlenko closed 1 week ago

dsamojlenko commented 2 weeks ago

Summary | Résumé

Fixes #4631

When confirming responses, the Downloaded tab should refresh once the dialog closes. Previous code relied on useRouter router.refresh() This stopped working after a refactor that moved the fetchResponses call to a client side useEffect.

To resolve, added a forceRefresh state to the dependency array of the useEffect. When the Confirm action completes, set a new timestamp with setForceRefresh and it will refetch the responses.

github-actions[bot] commented 2 weeks ago

:test_tube: Review environment

https://mcrla5a5cqcj7h2o4vaukfewty0dzlqt.lambda-url.ca-central-1.on.aws/