Skip to content

fix: 본문이 비어 있으면 게시글 작성, 수정을 제출할 수 없게 함 - #225

Merged
howooyeon merged 1 commit into
mainfrom
fix/write-empty-content
Sep 29, 2026
Merged

howooyeon merged 1 commit into
mainfrom
fix/write-empty-content

Conversation

@howooyeon

@howooyeon howooyeon commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

문제

게시글 작성/수정에서 본문을 비운 채로 제출할 수 있었습니다.

useWriteForm의 제출 가능 조건이 제목만 보고 있었습니다.

const isSubmittable = title.trim().length > 0;

서버는 title과 content를 둘 다 필수로 받습니다(FreePostCreateRequest.required: ["content", "title"], POST /api/community/free-posts → 400 본문 누락). 그래서 제목만 쓰고 완료를 누르면 버튼이 활성화된 채 요청이 나가고, 400을 받아 "게시글 업로드에 실패했어요" 토스트만 뜹니다. 사용자는 무엇이 잘못됐는지 알 수 없습니다.

변경

const isSubmittable = title.trim().length > 0 && body.trim().length > 0;

본문이 비어 있으면 제출 버튼이 기존 비활성 스타일(bg-fill-disabled)로 유지됩니다. 제목이 비었을 때와 동일한 동작이라 새로운 UI는 추가하지 않았습니다. 작성/수정 두 모드 모두 같은 훅을 쓰므로 함께 적용됩니다.

회귀 방지 테스트를 추가했습니다(5 케이스 — 정상/본문 빈 값/제목 빈 값/공백만 입력/입력 후 삭제).

확인 범위

댓글 작성(comment-input-bar.tsx)은 이미 !text.trim() 가드가 있어 같은 문제가 없습니다. 게시글 폼만 비어 있었습니다.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: SEMOSAN/SEMOSAN_FE/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 45ef49e2-2957-4ae9-bb34-1c28177e23cf

📥 Commits

Reviewing files that changed from the base of the PR and between 6835d0b and 5488b63.

📒 Files selected for processing (2)
  • features/community/write/hooks/__tests__/use-write-form.test.ts
  • features/community/write/hooks/use-write-form.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@howooyeon howooyeon changed the title fix: 본문이 비어 있으면 게시글 작성·수정을 제출할 수 없게 함 fix: 본문이 비어 있으면 게시글 작성, 수정을 제출할 수 없게 함 Sep 28, 2026
@howooyeon howooyeon self-assigned this Sep 28, 2026
@JioCoder

Copy link
Copy Markdown
Contributor

확인했습니다!

@howooyeon
howooyeon merged commit 8e9e4cd into main Sep 29, 2026
3 checks passed
@howooyeon
howooyeon deleted the fix/write-empty-content branch September 29, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants