Skip to content

Commit 63c7781

Browse files
authored
fix: postman attachments selector (#1101)
## Problem * Postman attachment input height shifts when changing from empty state to selecting an attachment. * Attachment tag keys are not unique when using default field name and default attachment from mock data. ## Solution * Increased the minHeight for the input so that it remains the same height regardless of whether an attachment was selected. * Added the index to the key to de-duplicate attachments particularly when using mock data and default field name. ## Tests - [ ] Attachments from FormSG can be selected and added to the email - [ ] Attachments can have the same field name and filename from FormSG (especially from mock data) and does not create duplicate Tags in the input field - [ ] Attachments can be uploaded at the Postman step and added to the email - [ ] Height of selector does not change when selecting / de-selecting attachment ## Before & After Screenshots **BEFORE**: https://github.com/user-attachments/assets/7192662f-1b65-4451-81dd-8f8a21778a58 **AFTER**: https://github.com/user-attachments/assets/3614b9d0-01d7-45b1-acd5-a8c86d3b6d91
1 parent 251d862 commit 63c7781

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/frontend/src/components/AttachmentSuggestions/components/TagList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ function TagList(props: TagsProps) {
2828

2929
return (
3030
<>
31-
{tags?.map((tag) => {
31+
{tags?.map((tag, index) => {
3232
const { label, value } = tag
3333
return (
3434
<Tag
35-
key={`${label}-${value}`}
35+
key={`${index}-${label}-${value}`}
3636
size="md"
3737
colorScheme="primary"
3838
borderRadius="md"

packages/frontend/src/components/AttachmentSuggestions/style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const boxStyles = {
1313
'&:focus-within': {
1414
borderColor: 'primary.500',
1515
},
16-
minHeight: '40px',
16+
minHeight: '46px',
1717
}
1818

1919
export const divWrapperStyles = { height: 40, width: '100%' }

0 commit comments

Comments
 (0)