Skip to content

Commit

Permalink
[FIX] 웹에서 태그 생성 후 빈 태그가 생성이 가능한 문제 해결 (#941)
Browse files Browse the repository at this point in the history
* fix: 태그를 생성하고 빈 공백이 생기는 이유 수정

* chore: 백엔드 API 타입 최신화
  • Loading branch information
dmdgpdi authored Jan 8, 2025
1 parent af894a6 commit ee4965c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function SharePickRecord({
}

interface SharePickRecordProps {
pickInfo: components['schemas']['baguni.api.service.sharedFolder.dto.SharedFolderResult$SharedPickInfo'];
tagList: components['schemas']['baguni.api.service.sharedFolder.dto.SharedFolderResult$SharedTagInfo'][];
pickInfo: components['schemas']['baguni.domain.infrastructure.sharedFolder.dto.SharedFolderResult$SharedPickInfo'];
tagList: components['schemas']['baguni.domain.infrastructure.sharedFolder.dto.SharedFolderResult$SharedTagInfo'][];
folderAccessToken: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,17 @@ export function PickTagAutocompleteDialog({
});
};

const checkIsCreatableTag = (value: string) => {
const isUnique = !tagList.some((tag) => tag.name === value.trim());
const isNotInitialValue = value.trim() !== '';
const isCreatable = isUnique && isNotInitialValue;

setCanCreateTag(isCreatable);
};

const clearTagInputValue = () => {
setTagInputValue('');
checkIsCreatableTag('');
};

const onSelectTag = (tag: TagType) => {
Expand Down Expand Up @@ -123,14 +132,6 @@ export function PickTagAutocompleteDialog({
}
};

const checkIsCreatableTag = (value: string) => {
const isUnique = !tagList.some((tag) => tag.name === value.trim());
const isNotInitialValue = value.trim() !== '';
const isCreatable = isUnique && isNotInitialValue;

setCanCreateTag(isCreatable);
};

useEffect(
function onOpenPickTagAutocompleteDialog() {
if (open) {
Expand Down

0 comments on commit ee4965c

Please sign in to comment.