diff --git a/src/App.tsx b/src/App.tsx
index 34edc8b..56d1926 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,6 +1,6 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
// import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
-import { useState } from 'react'
+import { Suspense, useState } from 'react'
import { Helmet, HelmetProvider } from 'react-helmet-async'
import { RouterProvider } from 'react-router-dom'
import styled, { ThemeProvider } from 'styled-components'
@@ -8,6 +8,7 @@ import PWABadge from '~/PWABadge'
import { router } from '~/router'
import GlobalStyle from '~/styles/globalStyle'
import { darkTheme, lightTheme } from '~/styles/theme'
+import PageLoader from '~components/PageLoader'
import PushNotification from '~components/PushNotification'
const queryClient = new QueryClient()
@@ -30,7 +31,9 @@ function App() {
-
+ }>
+
+
diff --git a/src/apis/chatRoom/useChatList.ts b/src/apis/chatRoom/useChatList.ts
index 402ca6d..3d85aa2 100644
--- a/src/apis/chatRoom/useChatList.ts
+++ b/src/apis/chatRoom/useChatList.ts
@@ -1,9 +1,9 @@
-import { useQuery } from '@tanstack/react-query'
+import { useSuspenseQuery } from '@tanstack/react-query'
import { fetchChatRoomList } from '~apis/chatRoom/fetchChatRoomList'
import { queryKey } from '~constants/queryKey'
export default function useChatList() {
- return useQuery({
+ return useSuspenseQuery({
queryKey: queryKey.social.chatRoomList(),
queryFn: () => fetchChatRoomList().then(res => res.data),
})
diff --git a/src/apis/chatRoom/useFriendList.ts b/src/apis/chatRoom/useFriendList.ts
index cf44112..ae3b3d5 100644
--- a/src/apis/chatRoom/useFriendList.ts
+++ b/src/apis/chatRoom/useFriendList.ts
@@ -1,9 +1,9 @@
-import { useQuery } from '@tanstack/react-query'
+import { useSuspenseQuery } from '@tanstack/react-query'
import { fetchFriendList } from '~apis/friend/fetchFriendList'
import { queryKey } from '~constants/queryKey'
export default function useFriendList() {
- return useQuery({
+ return useSuspenseQuery({
queryKey: queryKey.social.friendList(),
queryFn: () => fetchFriendList().then(res => res.data),
})
diff --git a/src/pages/SocialPage/components/FriendChatList/index.tsx b/src/pages/SocialPage/components/FriendChatList/index.tsx
index 45eca90..09f0d1e 100644
--- a/src/pages/SocialPage/components/FriendChatList/index.tsx
+++ b/src/pages/SocialPage/components/FriendChatList/index.tsx
@@ -14,7 +14,9 @@ function FriendList() {
return (
- {friendList?.map(friendInfo => )}
+ {[...friendList].reverse().map(friendInfo => (
+
+ ))}
)
}
@@ -24,7 +26,9 @@ function ChatList() {
return (
- {chatList?.map(chatInfo => )}
+ {[...chatList].reverse().map(chatInfo => (
+
+ ))}
)
}
diff --git a/src/router.tsx b/src/router.tsx
index 4e3b45f..03fa02b 100644
--- a/src/router.tsx
+++ b/src/router.tsx
@@ -6,19 +6,29 @@ import GlobalHookContainer from '~components/GlobalHookContainer'
import PageLoader from '~components/PageLoader'
import ModalContainer from '~modals/ModalContainer'
import * as Pages from './components/LazyComponents'
+import { QueryErrorResetBoundary } from '@tanstack/react-query'
+import { ErrorBoundary } from 'react-error-boundary'
+import ErrorFallback from '~components/ErrorFallback'
export const router = createBrowserRouter([
{
path: '/',
element: (
-
- }>
-
-
-
-
-
+
+ {({ reset }) => (
+
+
+ }>
+
+
+
+
+
+
+
+ )}
+
),
children: [