fix: replace item popup with shared item popup, adjust props and actions - #1034
fix: replace item popup with shared item popup, adjust props and actions#1034tomrndom wants to merge 1 commit into
Conversation
…in actions, add tests Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
💤 Files with no reviewable changes (2)
📝 WalkthroughWalkthroughThe PR consolidates sponsor item creation and updates into ChangesSponsor item CRUD
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
|
||
| return Promise.all(promises).then(() => { | ||
| if (entity.id) { | ||
| return putRequest( |
There was a problem hiding this comment.
@tomrndom This branch was cut from 78ef677c (Aug 3) and does not contain #1002 (merged Aug 21), so this rewrite of saveSponsorFormItem sits on top of the pre-#1002 version of the file and reverts it. GitHub already reports the PR as CONFLICTING; master is 31 commits ahead.
#1002 deliberately stopped sending images in the item request body, because the nested-images path replaces the whole collection on update. origin/master:src/actions/sponsor-forms-actions.js:1424-1429:
// Images are never round-tripped inline: the item add/update endpoint's
// nested-images path only clones the file name (no S3 copy) and, on
// update, replaces the whole collection - wiping cloned-from-inventory
// images whose id it can't preserve. New uploads are persisted separately
// via saveNewItemImages once the item itself is saved.
delete normalizedEntity.images;With this branch's normalizeItem, stored images are filtered out — file_path is write_only in purchases-api's ShowFormItemImageSerializer, so a fetched item only carries id + file_url — and the PUT sends images: []. ShowFormItemService.update then runs form_item.images.all().delete() (show_form_item_service.py:95-97). Concretely: upload an image, save, reopen the item, edit the name, save — every image on that item is gone.
What merging as-is would undo:
| # | master (post-#1002) | this branch |
|---|---|---|
| 1 | delete normalizedEntity.images |
images.filter(img => img.file_path) → PUT sends images: [] → collection wiped |
| 2 | saveNewItemImages posts new uploads to /items/{id}/images |
removed |
| 3 | onImageDeleted on SponsorItemDialog, wired to MuiFormikUpload's onDelete |
absent |
| 4 | removeItemFile wired through handleRemoveItemImage in the list page |
absent |
| 5 | expand: "images" on the save request params |
absent |
| 6 | ~450 lines of saveSponsorFormItem / updateSponsorFormItem tests, including "omits persisted images from the update request body so they are never round-tripped" |
replaced by the pre-#1002 file |
Could you rebase onto master and rebuild the change on top of #1002? The intent here — one shared dialog, a single save action, requireDefaultQuantity — still holds. On the new base it needs to keep delete normalizedEntity.images + saveNewItemImages, the expand: "images" param, onImageDeleted passed from sponsor-form-item-list-page/index.js, and master's existing tests, extended to cover the new POST/PUT branch.
ref: https://app.clickup.com/t/9014802374/86bb7u2gt
Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com
Summary by CodeRabbit
New Features
Bug Fixes