Enable routing from eligibility form to case screen #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's new in this PR
Added functionality to enable routing from eligibility form back to case screen and have it be updated.
Description
After updating the eligibility by pressing one of the eligibility option buttons, we re-fetch the case from Supabase, and pass that as a route parameter to the Case screen in order for it to properly render the new update.
Screenshots
How to review
Click into a CaseCard to go into the Case screen, and navigate to the Eligibility form. Try opting in, and then you should be taken back to the Case screen, but have the info presented be updated to show you the proper changes.
Next steps
This is a version 1 solution. I think ideally what we would want is to create dynamic routing for the CaseScreen where it can take the caseId as the parameter. Then we probably want to lift the state of status up so that both the CaseScreen and EligibilityForm (and anything else that may use it) can call setStatus as that is essentially the only front-end thing that needs to be changed. Not exactly sure how this can be done simply because it seems that we can't pass setState functions through router.push without errors as of right now.
I would say that we shouldn't need to refetch the case or case status when navigating between CaseScreen, Eligibility Form, and Case Summary. The case data should just remain constant I believe, and the status should be updated through a useState variable. Additionally, we should set up dynamic routing for the CaseScreen.
Relevant Links
Online sources
Related PRs
CC: @stephaniewong2