Fix issue in deployed apps where StateSubmissions are shown as Draft after submission #176
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.
Summary
Issue found in acceptance, it's not reproducing locally so I'm going to try and figure it out in the review app.
OMG What a rabbit hole.
SO. The bug was that in prod after submission the card would still show "DRAFT" instead of "SUBMITTED". This didn't happen locally.
To try and solve this, we were calling "refetchQueries" on our submit mutation, thinking that the query would be refetched and the fresh data would be in it when we redirected. This turned out not to work in prod because of a confluence of reasons:
Phew.
The fix is to delete the data from the cache instead of calling refetchQueries. This more accurately maps to what we want to happen anyway so it's a good fix.
Related issues
Screenshots
Testing guidance
I updated the cypress test to catch this issue, but run through a full submission from scratch in the review app and make sure that the card says "Submitted" afterwards.