Multi-photo posts in a headless UNA front end: what I learned
This week I finally fixed the thing that has been haunting our photo uploads: posting more than a handful of images from the mobile app on a bad connection. Writing down what I learned, mostly so future me stops making the same mistakes at 2am.
Upload first, post second
My first version sent the text and every image in one request. One dropped connection and the whole post failed, text included. Now each photo uploads to UNA's storage on its own as soon as you pick it, and the post is only created once every file has an ID. If you're typing a caption while the photos upload, you never notice.
Retry like you mean it
Each upload gets up to three retries with a short backoff. On the train, that took a ten-photo post from failing about 40% of the time to basically never in my testing. Not scientific, but I rode the same line four times to check, so I'm counting it.
Order is part of the content
People pick their best photo first for a reason. Uploads finish in random order, so I keep the order from the picker and send it with the post instead of trusting whatever came back first. Reordering in the composer works now too, so you can drag the group shot to the front.
Show progress honestly
A spinner that never ends makes people give up. Each thumbnail now gets its own small progress ring and a clear retry button if it fails for good.
If you build on headless UNA and handle uploads differently, let's compare notes in UNA Builders. Code snippets welcome, especially if they make mine look bad.
Info
html
asdasdasd

