Dentolize · Upload Progress Walkthrough
On this pageBusiness viewTechnical view

Overview

Business view

Staff using the Dentolize mobile app upload files constantly — a clock-in photo, a patient X-ray, a screenshot for a patient's chart, a voice note dictated after an appointment. Until now, all the app could show while any of those uploaded was a plain spinning wheel. For a small photo that was a minor annoyance. For a large file, or a slow clinic Wi-Fi connection, the spinner could sit there for a long time with nothing to distinguish "still working" from "frozen." Staff had no way to tell whether to wait, retry, or worry.

This PR (#416, mo/file_upload_progress) replaces the plain spinner with one that reports real progress: a percentage, the size being sent, and — once there's enough data to estimate it — the upload speed. It shows up everywhere the app uploads a file:

  • Clocking in or out with a photo
  • Adding a file to a patient's record (photo, document, or screenshot)
  • Recording a voice note on a patient's chart
  • Sending a voice message in the internal staff chat

Technical view

The change is confined to packages/clinic-mobile. Nothing on the server or in any web package was touched. Three things changed to make this possible:

  1. A new hook, useUploadProgress (packages/clinic-mobile/src/hooks/useUploadProgress.js)

tracks the bytes sent and expected for one or more concurrent uploads, and derives a percentage and a human-readable detail line ("12.4 MB · Speed: 1.8 MB/s") from them. See Knowing how far along an upload is.

  1. handleUploadFile (packages/clinic-mobile/src/components/dashboard/patients/patient/files/handleUploadFile.js)

was rewritten so both of its upload routes — the presigned S3 POST and the Google Drive resumable PUT — report bytes-sent as they go, instead of reporting nothing until the request finishes. See Streaming the bytes instead of buffering them.

  1. Four screens were wired up to feed the hook and pass its output to AppSpinner,

which grew a detail line under the existing percentage text. See Where it shows up.

The feature is mobile-only and depends on a native module (expo-file-system's createUploadTask) that has no browser implementation, so it cannot be exercised from a desktop browser or from this repo's web packages — see the Walkthrough page for how that constraint shaped the screenshots in this site.