wire up photo upload on donation details submission (REP-49) - #33
Closed
stephenhungg wants to merge 2 commits into
Closed
Conversation
Capture the PhotoUpload component's selected URI in local state and pass it through submitCompletionDetails. When a photo is present the request is sent as multipart/form-data with task[...] field namespacing (wrap_parameters is JSON-only on the backend, so keys need to be pre-wrapped for multipart). Content-Type is intentionally not set so fetch can fill in the multipart boundary automatically. Closes REP-49
CI's pnpm install --frozen-lockfile was failing across PRs #30, #32, #33 because pnpm-lock.yaml had react-native-svg pinned at ^15.15.3 but package.json says 15.12.1. Regenerated the lockfile so the specifier matches. Drift is pre-existing on the design-system-overhaul branch and just propagated up the stack.
stephenhungg
added a commit
that referenced
this pull request
Apr 10, 2026
CI's pnpm install --frozen-lockfile was failing across PRs #30, #32, #33 because pnpm-lock.yaml had react-native-svg pinned at ^15.15.3 but package.json says 15.12.1. Regenerated the lockfile so the specifier matches. Drift is pre-existing on the design-system-overhaul branch and just propagated up the stack.
5 tasks
Contributor
Author
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.
Summary
Closes REP-49 on the mobile side. Captures the selected photo URI in state and sends it through the completion endpoint as multipart/form-data. Pairs with backend PR replate/replate-business#2803 which adds the Paperclip attachment on
Task.Changes
src/app/donation-details/[id].tsxphotoUristate (string | null), wired intoPhotoUpload.onSelect={setPhotoUri}(was a no-op before).handleCompletepassesphotoUriintosubmitCompletionDetails.api/config.tssubmitCompletionDetailsnow accepts optionalphotoUri. When present, it switches from JSON toFormData:task[total_pounds_entered],task[description],task[photo]because the backend'swrap_parametersis JSON-only, so keys need to be pre-wrapped for multipart to land underparams["task"][...].{uri, name, type}— React Native's FormData convention for file uploads. Filename and mime inferred from the expo-image-picker URI (defaults toimage/jpeg, switches toimage/pngon.png).multipart/form-data; boundary=...automatically — setting it manually breaks the boundary.Base branch
Targeting
stephenhung/rep-41-connect-my-tasks-detailsbecause the issue's dev workflow says to branch off the previous sprint's branch. This is a stacked PR — REP-41 should land first, then this rebases onto design-system-overhaul (or main depending on how REP-41 gets merged).Notes / flags
apiRequestcallsresponse.json()on a 204 No Content response — the endpoint returnshead 204, which will makeresponse.json()throw on an empty body. This is a latent bug from before REP-49, not something this PR introduces. The error gets swallowed by the try/catch inhandleComplete, so the user still sees "Donation recorded!" and the redirect fires. Worth fixing in a follow-up.FormData.appendaccepts{uri, name, type}file objects, but TypeScript's DOM types only acceptBlob | string. Usedas unknown as Blobwhich is the standard workaround.Test plan
pnpm tsccleanpnpm lint:checkcleanpnpm prettier:checkcleanTask.last.photo_file_namepopulates in Rails console (requires backend PR #2803 deployed)Testing status — heads up
I did NOT manually run the app to test this end-to-end. All that was verified is static analysis: TypeScript, ESLint, Prettier, and the husky pre-commit hook — all clean. The backend + mobile need to be deployed together and poked manually (the issue's check step uses Rails console +
Task.last.photo_file_name).🤖 Generated with Claude Code