feat(reports): keep reports on the phone when the network is down - #202
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #188
Overview
A patroller who wrote a report with no signal lost it, photo and all. Sending now goes through a normal API route instead of a server action, because a background retry cannot call a server action. When the request cannot reach the server, the report and its photo are saved on the phone and sent later on their own. Each report gets an id made on the phone, so sending it twice only ever creates one row.
Retrying lives in the root layout, so it works anywhere in the app and not just on the report screen. The report screen also shows how many are still waiting.
Testing
296 tests pass, including new ones for saving and rebuilding a queued report with its photo. tsc, eslint, prettier and the build are all clean.
Screenshots / Screencasts
No new screens. The report screen shows a line saying how many reports are waiting, and the confirmation says the report will be sent later when it was saved offline.
Checklist
Notes
None.