-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix multi-attachment comments rendering as separate messages #82533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,14 @@ const prepareRequestPayload: PrepareRequestPayload = (command, data) => { | |
| continue; | ||
| } | ||
|
|
||
| if (Array.isArray(value)) { | ||
| value.forEach((singleValue) => { | ||
| validateFormDataParameter(command, key, singleValue); | ||
| formData.append(key, singleValue as string | Blob); | ||
| }); | ||
| continue; | ||
|
Comment on lines
+17
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new generic Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| validateFormDataParameter(command, key, value); | ||
| formData.append(key, value as string | Blob); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ CONSISTENCY-6 (docs)
Bug:
addActionsis not updated to handleFileObject[]but now receives it.The
addActionsfunction (lines 612-806) uses truthiness checks onfilethroughout:if (text && \!file)(line 622) — an empty array[]is truthy, so this branch is skipped even when there are no filesif (file)(line 628) — truthy for[], so it would try tobuildOptimisticAddCommentReportActionwith an empty arrayif (text && file)(line 636) — same issue, setscommandName = ADD_TEXT_AND_ATTACHMENTeven for empty arraysfile ?ternaries (lines 688, 692) — would select attachment paths even when there are no actual filesSince
attachmentsfromaddAttachmentWithCommentis typed asFileObject | FileObject[], and the caller can pass an array,addActionsneeds to be updated to handle arrays properly. At minimum, the truthiness checks should use something like:And replace all
file/\!filechecks withhasFile/\!hasFile.Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.