·   ·  8 posts
  • 1 followers
  • 2 friends

Multi-photo posts in a headless UNA front end: what I learned

Upload queues, retries on bad Wi-Fi and keeping photos in the order you picked them.

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.

  • 462

Info

Category:
Created:
Updated:

html

asdasdasd

Comments (18)

    • Honestly, this is the first time our clean-up album makes sense to someone who wasn't there. That's the whole point of posting them.

      • Emily Smith, tip: photos show in the order you pick them, so start with your best shot.

        • Same goes for anyone posting event recaps: lead with the people, not the venue.

          • Thanks Jackson, and thanks to everyone who tested this before the rest of us got to it.

            • And thanks in advance to whoever reads my comment spree in the morning. Bed after one more upload, promise.

            • Last one, honest: the full Saturday gallery is up on my profile. Volunteers and friends, go and find yourselves in it.

              Login or Join to comment.