Tool/React
![[React] Suspense와 React-query의 onSuccess](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbPAk5L%2FbtrOkRVbqZb%2FAAAAAAAAAAAAAAAAAAAAAFwwZqiU9hgU-Hp4XDutl36LVeJt7YOgxpdiHFyfizj1%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1756652399%26allow_ip%3D%26allow_referer%3D%26signature%3DRFPBqTbL6P3Ki%252BU7dPls3S78x%252BM%253D)
[React] Suspense와 React-query의 onSuccess
프로젝트에 suspense를 적용하기를 하는 도중 에러가 발생했다.(정확히 에러는 아니고 버그?) const { data: chatRoom, isLoading } = useChatRoomQuery(chatRoomId, { enabled: isLoggedIn && !!chatRoomId, cacheTime: 0, onSuccess: (data) => { setNewChatLog(data.data.chatRoom.messages); }, }); onSuccess가 실행 되었음에도 불구하고 newChatLog에 데이터가 없었다. 이는 Suspense를 적용하면서 생긴 문제인데. Suspense의 동작 순서와 관련이 있다. Suspense mount Main mount (1) Main의 useQuery(api)..