Fix(audience): 공지 저장 뷰 이미지 오류 해결#339
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit릴리스 노트
Walkthrough저장된 공지 조회 로직을 features에서 entities로 옮기고 API 헬퍼 및 쿼리 옵션을 도입했습니다. 타입 구조를 정리해 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
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. Comment Tip You can validate your CodeRabbit configuration file in your editor.If your editor has YAML language server, you can enable auto-completion and validation by adding |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/audience/src/entities/notice/model/query-options.ts`:
- Around line 28-34: SAVED_NOTICES_QUERY_OPTIONS.LIST currently calls
getSavedNotices without supporting AbortSignal, unlike
NOTICES_QUERY_OPTIONS.LIST; update getSavedNotices to accept an options object
(e.g., { signal?: AbortSignal, ...params }) and then change
SAVED_NOTICES_QUERY_OPTIONS.LIST to forward the signal into queryOptions's
queryFn so the AbortSignal passed by react-query (or your queryOptions helper)
cancels the network request; ensure types (PageSizeParams or a new interface)
are updated and queryOptions usage remains consistent.
In `@apps/audience/src/entities/notice/types/types.ts`:
- Line 1: Replace the value import of Pagination with a type-only import to
avoid pulling runtime dependencies into the bundle: change the current import
statement that references Pagination in types.ts to a type-only import (i.e.,
use the TypeScript `import type { Pagination }` form) so the symbol Pagination
is treated purely as a type and stripped from the emitted JS.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8135fa2b-0ca8-495b-8b6d-a0c11faf1853
📒 Files selected for processing (7)
apps/audience/src/entities/notice/api/notice.tsapps/audience/src/entities/notice/model/query-options.tsapps/audience/src/entities/notice/types/types.tsapps/audience/src/features/saved-notice/query.tsapps/audience/src/pages/saved-notices/saved-notices.tsxapps/audience/src/shared/types/index.tsapps/audience/src/shared/types/pagination.ts
💤 Files with no reviewable changes (1)
- apps/audience/src/features/saved-notice/query.ts
| export const SAVED_NOTICES_QUERY_OPTIONS = { | ||
| LIST: (params: PageSizeParams = {}) => | ||
| queryOptions({ | ||
| queryKey: [...USERS_QUERY_KEY.SAVED_NOTICES(), params], | ||
| queryFn: () => getSavedNotices(params), | ||
| }), | ||
| } as const; |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Suggest: AbortSignal 지원 추가를 고려해보세요.
NOTICES_QUERY_OPTIONS.LIST는 signal을 전달해서 요청 취소를 지원하는데, SAVED_NOTICES_QUERY_OPTIONS.LIST는 signal을 전달하지 않아요. 사용자가 페이지를 빠르게 이탈할 때 불필요한 네트워크 요청이 계속될 수 있어요.
현재 getSavedNotices 함수가 options를 받지 않아서 signal을 전달할 수 없는 구조인데, 일관성과 UX 개선을 위해 추후 리팩토링 시 고려해주시면 좋을 것 같아요.
♻️ 제안하는 수정 방향 (notice.ts와 query-options.ts 둘 다 수정 필요)
notice.ts:
-export const getSavedNotices = (params: PageSizeParams = {}) =>
- get<SavedNoticesResponse, PageSizeParams>(
+export const getSavedNotices = (
+ params: PageSizeParams = {},
+ options: RequestOptions = {},
+) =>
+ get<SavedNoticesResponse, PageSizeParams>(
END_POINT.GET_SAVED_NOTICES,
params,
+ options,
);query-options.ts:
export const SAVED_NOTICES_QUERY_OPTIONS = {
LIST: (params: PageSizeParams = {}) =>
queryOptions({
queryKey: [...USERS_QUERY_KEY.SAVED_NOTICES(), params],
- queryFn: () => getSavedNotices(params),
+ queryFn: ({ signal }) => getSavedNotices(params, { signal }),
}),
} as const;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/audience/src/entities/notice/model/query-options.ts` around lines 28 -
34, SAVED_NOTICES_QUERY_OPTIONS.LIST currently calls getSavedNotices without
supporting AbortSignal, unlike NOTICES_QUERY_OPTIONS.LIST; update
getSavedNotices to accept an options object (e.g., { signal?: AbortSignal,
...params }) and then change SAVED_NOTICES_QUERY_OPTIONS.LIST to forward the
signal into queryOptions's queryFn so the AbortSignal passed by react-query (or
your queryOptions helper) cancels the network request; ensure types
(PageSizeParams or a new interface) are updated and queryOptions usage remains
consistent.
Sohyunnnn
left a comment
There was a problem hiding this comment.
이미지 잘 뜨는 거 확인했습니다. 수고하셨습니다 👍
eunkr82
left a comment
There was a problem hiding this comment.
확인했습니다! 페이지네이션 타입 정의 너무 좋네요~~ 👍👍
📌 Summary
공지 저장 뷰에서 이미지가 렌더링 되지 않는 문제를 해결합니다.
📚 Tasks
🔍 Describe
공지 저장 뷰 이미지 오류 해결
공지 저장 뷰에서 이미지가 렌더링 되지 않는 문제를 해결했습니다. 기존에는 단일 이미지 문자열을 받아왔으나, 스프린트 기간에 여러 이미지 업로드가 가능해지면서 API 명세가 바뀌었고 그에 따른 수정을 진행했습니다.
저장된 공지를 불러오는 API와 관련한 타입에 한해서,
shared레이어에서entities로 이동했습니다. 현재 각 파일마다 페이지네이션 타입을 정의해서 사용하고 있어, 중복된 코드가 많습니다. 따라서 기능 개발 후 리팩토링 때 사용할pagination타입을 정의했습니다. 현재 전체적인 타입 수정이 이뤄지면 여러 사이드 이펙트가 우려되므로, 기능 개발 후 팀 내 논의를 통해 전면적인 리팩토링을 진행할 예정입니다.👀 To Reviewer
📸 Screenshot