From a23e68d4f279a2e9c3c3271f8b249cc326e96ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A4=80=EC=98=81?= Date: Sun, 1 Mar 2026 01:14:52 +0900 Subject: [PATCH 1/3] chore: sentry setting change --- src/config/sentry.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config/sentry.ts b/src/config/sentry.ts index 271f5378..7b91af71 100644 --- a/src/config/sentry.ts +++ b/src/config/sentry.ts @@ -36,8 +36,8 @@ export function initSentry() { matchRoutes, }), Sentry.replayIntegration({ - maskAllText: true, - blockAllMedia: true, + maskAllText: false, + blockAllMedia: false, }), ], tracePropagationTargets: ['localhost', ...(import.meta.env.VITE_API_PATH ? [import.meta.env.VITE_API_PATH] : [])], From aa6e922c1bda5779bd17a8cc78a804a58035750b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A4=80=EC=98=81?= Date: Sun, 1 Mar 2026 01:15:09 +0900 Subject: [PATCH 2/3] fix: chat roomType bug fix --- src/apis/chat/entity.ts | 6 ++++- src/apis/chat/index.ts | 7 +++-- src/pages/Chat/hooks/useChat.ts | 45 ++++++++------------------------- 3 files changed, 18 insertions(+), 40 deletions(-) diff --git a/src/apis/chat/entity.ts b/src/apis/chat/entity.ts index 5f7e3536..370f4d9b 100644 --- a/src/apis/chat/entity.ts +++ b/src/apis/chat/entity.ts @@ -26,9 +26,13 @@ export interface ChatMessage { isMine: boolean; } +export interface SendChatMessageRequest { + chatRoomId: number; + content: string; +} + export interface ChatMessageRequestParam extends PaginationParams { chatRoomId: number; - type: 'DIRECT' | 'GROUP'; } export interface ChatMessagesResponse extends PaginationResponse { diff --git a/src/apis/chat/index.ts b/src/apis/chat/index.ts index a813d8b5..ff5e8271 100644 --- a/src/apis/chat/index.ts +++ b/src/apis/chat/index.ts @@ -5,6 +5,7 @@ import type { ChatMessagesResponse, ChatRoomsResponse, CreateChatRoomResponse, + SendChatMessageRequest, } from './entity'; export const getChatRooms = async () => { @@ -22,9 +23,8 @@ export const postChatRooms = async (userId: number) => { return response; }; -export const postChatMessage = async (chatRoomId: number, type: 'DIRECT' | 'GROUP', content: string) => { +export const postChatMessage = async ({ chatRoomId, content }: SendChatMessageRequest) => { return apiClient.post(`chats/rooms/${chatRoomId}/messages`, { - params: { type }, body: { content }, requiresAuth: true, }); @@ -37,9 +37,8 @@ export const getChatMessages = async ({ chatRoomId, ...query }: ChatMessageReque }); }; -export const postChatMute = async (chatRoomId: number, type: 'DIRECT' | 'GROUP') => { +export const postChatMute = async (chatRoomId: number) => { return apiClient.post<{ isMuted: boolean }>(`chats/rooms/${chatRoomId}/mute`, { - params: { type }, requiresAuth: true, }); }; diff --git a/src/pages/Chat/hooks/useChat.ts b/src/pages/Chat/hooks/useChat.ts index 447f6978..74dac321 100644 --- a/src/pages/Chat/hooks/useChat.ts +++ b/src/pages/Chat/hooks/useChat.ts @@ -1,14 +1,11 @@ -import { useMemo } from 'react'; import { useMutation, useSuspenseQuery, useInfiniteQuery, useQueryClient } from '@tanstack/react-query'; import { getChatMessages, getChatRooms, postChatMessage, postChatRooms, postChatMute } from '@/apis/chat'; import { useGetClubMembers } from '@/pages/Club/ClubDetail/hooks/useGetClubMembers'; -type ChatType = 'DIRECT' | 'GROUP'; - export const chatQueryKeys = { all: ['chat'] as const, rooms: () => [...chatQueryKeys.all, 'rooms'] as const, - messages: (chatRoomId: number, type: ChatType) => [...chatQueryKeys.all, 'messages', chatRoomId, type] as const, + messages: (chatRoomId: number) => [...chatQueryKeys.all, 'messages', chatRoomId] as const, }; const useChat = (chatRoomId?: number) => { @@ -20,11 +17,6 @@ const useChat = (chatRoomId?: number) => { refetchInterval: 5000, }); - const currentRoomType: ChatType | undefined = useMemo(() => { - if (!chatRoomId) return undefined; - return chatRoomList.rooms.find((room) => room.roomId === chatRoomId)?.chatType; - }, [chatRoomId, chatRoomList.rooms]); - const { mutateAsync: createChatRoom } = useMutation({ mutationKey: ['createChatRoom'], mutationFn: (userId: number) => postChatRooms(userId), @@ -36,17 +28,13 @@ const useChat = (chatRoomId?: number) => { hasNextPage, isFetchingNextPage, } = useInfiniteQuery({ - queryKey: - chatRoomId && currentRoomType - ? chatQueryKeys.messages(chatRoomId, currentRoomType) - : ['chat', 'messages', 'disabled'], + queryKey: chatRoomId ? chatQueryKeys.messages(chatRoomId) : ['chat', 'messages', 'disabled'], - enabled: !!chatRoomId && !!currentRoomType, + enabled: !!chatRoomId, queryFn: ({ pageParam }) => getChatMessages({ chatRoomId: chatRoomId!, - type: currentRoomType!, page: pageParam, limit: 20, }), @@ -62,28 +50,15 @@ const useChat = (chatRoomId?: number) => { const totalUnreadCount = chatRoomList.rooms.reduce((sum, room) => sum + room.unreadCount, 0); - const { mutateAsync: sendMessage } = useMutation< - Awaited>, - Error, - { chatRoomId: number; content: string } - >({ + const { mutate: sendMessage } = useMutation({ mutationKey: ['sendMessage', chatRoomId], - - mutationFn: async ({ chatRoomId, content }) => { - if (!currentRoomType) { - throw new Error('chatType is missing'); - } - - return postChatMessage(chatRoomId, currentRoomType, content); - }, + mutationFn: postChatMessage, onSuccess: () => { - if (!chatRoomId || !currentRoomType) return; - + if (!chatRoomId) return; queryClient.invalidateQueries({ - queryKey: chatQueryKeys.messages(chatRoomId, currentRoomType), + queryKey: chatQueryKeys.messages(chatRoomId), }); - queryClient.invalidateQueries({ queryKey: chatQueryKeys.rooms(), }); @@ -97,11 +72,11 @@ const useChat = (chatRoomId?: number) => { const { mutateAsync: toggleMute } = useMutation({ mutationKey: ['toggleMute', chatRoomId], mutationFn: async () => { - if (!chatRoomId || !currentRoomType) { - throw new Error('chatRoomId or type missing'); + if (!chatRoomId) { + throw new Error('chatRoomId is missing'); } - return postChatMute(chatRoomId, currentRoomType); + return postChatMute(chatRoomId); }, onSuccess: () => { queryClient.invalidateQueries({ From d248b02d84d36da0862c60b547173638a0fd5d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A4=80=EC=98=81?= Date: Sun, 1 Mar 2026 01:15:24 +0900 Subject: [PATCH 3/3] fix: duplicate next operation fix --- src/pages/Guide/hooks/useGuideSlider.ts | 14 +++++++------ src/pages/Guide/index.tsx | 28 +++---------------------- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/src/pages/Guide/hooks/useGuideSlider.ts b/src/pages/Guide/hooks/useGuideSlider.ts index c70b54f9..3d151196 100644 --- a/src/pages/Guide/hooks/useGuideSlider.ts +++ b/src/pages/Guide/hooks/useGuideSlider.ts @@ -5,20 +5,22 @@ export function useGuideSlider(total: number) { const navigate = useNavigate(); const [index, setIndex] = useState(0); - const isLast = index === total - 1; + const isLast = total > 0 && index === total - 1; const next = useCallback(() => { + if (total <= 0) return; + if (isLast) { navigate('/home'); return; } - setIndex((prev) => prev + 1); - }, [isLast, navigate]); + + setIndex((prev) => Math.min(prev + 1, total - 1)); + }, [isLast, navigate, total]); const prev = useCallback(() => { - if (index === 0) return; - setIndex((prev) => prev - 1); - }, [index]); + setIndex((prev) => Math.max(prev - 1, 0)); + }, []); return { index, diff --git a/src/pages/Guide/index.tsx b/src/pages/Guide/index.tsx index c371dcde..ca51efb1 100644 --- a/src/pages/Guide/index.tsx +++ b/src/pages/Guide/index.tsx @@ -1,32 +1,15 @@ -import { useEffect, useRef } from 'react'; import { GUIDE_ITEMS } from './guideData'; import GuideProgressBar from './GuideProgressBar'; import { useGuideSlider } from './hooks/useGuideSlider'; import { useSwipe } from './hooks/useSwipe'; function GuidePage() { - const timerRef = useRef(null); - const { index, next, prev } = useGuideSlider(GUIDE_ITEMS.length); const { onTouchStart, onTouchEnd } = useSwipe(next, prev); const item = GUIDE_ITEMS[index]; - - useEffect(() => { - if (timerRef.current) { - clearTimeout(timerRef.current); - } - - timerRef.current = window.setTimeout(() => { - next(); - }, item.duration ?? 3000); - - return () => { - if (timerRef.current) { - clearTimeout(timerRef.current); - } - }; - }, [index, item.duration, next]); + if (!item) return null; + const duration = item.duration ?? 3000; return (
- +