Skip to content

Commit 357e5a3

Browse files
committed
chore: 안쓰는 쿼리 정리
1 parent bbb19f5 commit 357e5a3

File tree

4 files changed

+4
-28
lines changed

4 files changed

+4
-28
lines changed

apps/frontend/src/features/pageSidebar/api/usePages.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,6 @@
1-
import { useQuery, useMutation, skipToken } from "@tanstack/react-query";
1+
import { useMutation } from "@tanstack/react-query";
22

3-
import {
4-
CreatePageRequest,
5-
createPage,
6-
deletePage,
7-
getPage,
8-
} from "@/entities/page";
9-
10-
export const usePage = (currentPage: number | null) => {
11-
const {
12-
data: page,
13-
isError,
14-
isLoading,
15-
} = useQuery({
16-
queryKey: ["page", currentPage],
17-
queryFn: currentPage ? () => getPage(currentPage) : skipToken,
18-
});
19-
20-
return { page, isError, isLoading };
21-
};
3+
import { CreatePageRequest, createPage, deletePage } from "@/entities/page";
224

235
export const useCreatePage = () => {
246
return useMutation({

apps/frontend/src/features/pageSidebar/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { usePage, useCreatePage } from "./api/usePages";
1+
export { useCreatePage } from "./api/usePages";
22

33
export { LogoBtn } from "./ui/LogoBtn";
44
export { NoteList } from "./ui/NoteList";

apps/frontend/src/widgets/EditorView/model/useEditorView.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ import { SocketIOProvider } from "y-socket.io";
66
import { useUserStore } from "@/entities/user";
77
import { usePageStore } from "@/entities/page";
88
import { useEditorStore } from "@/features/editor";
9-
import { usePage } from "@/features/pageSidebar";
109
import { createSocketIOProvider } from "@/shared/api";
1110

1211
export const useEditorView = () => {
1312
const { currentPage } = usePageStore();
1413
const { isPanelOpen, isMaximized, setIsPanelOpen } = useEditorStore();
15-
const { page, isLoading } = usePage(currentPage);
1614
const [saveStatus, setSaveStatus] = useState<"saved" | "unsaved">("saved");
1715
const [ydoc, setYDoc] = useState<Y.Doc | null>(null);
1816
const [provider, setProvider] = useState<SocketIOProvider | null>(null);
@@ -55,8 +53,6 @@ export const useEditorView = () => {
5553
currentPage,
5654
isPanelOpen,
5755
isMaximized,
58-
isLoading,
59-
page,
6056
ydoc,
6157
provider,
6258
saveStatus,

apps/frontend/src/widgets/EditorView/ui/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@ export function EditorView() {
88
currentPage,
99
isPanelOpen,
1010
isMaximized,
11-
isLoading,
12-
page,
1311
ydoc,
1412
provider,
1513
saveStatus,
1614
handleEditorUpdate,
1715
users,
1816
} = useEditorView();
1917

20-
if (isLoading || !page || currentPage === null) {
18+
if (currentPage === null) {
2119
return null;
2220
}
2321

0 commit comments

Comments
 (0)