File tree Expand file tree Collapse file tree 4 files changed +4
-28
lines changed
Expand file tree Collapse file tree 4 files changed +4
-28
lines changed Original file line number Diff line number Diff line change 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
235export const useCreatePage = ( ) => {
246 return useMutation ( {
Original file line number Diff line number Diff line change 1- export { usePage , useCreatePage } from "./api/usePages" ;
1+ export { useCreatePage } from "./api/usePages" ;
22
33export { LogoBtn } from "./ui/LogoBtn" ;
44export { NoteList } from "./ui/NoteList" ;
Original file line number Diff line number Diff line change @@ -6,13 +6,11 @@ import { SocketIOProvider } from "y-socket.io";
66import { useUserStore } from "@/entities/user" ;
77import { usePageStore } from "@/entities/page" ;
88import { useEditorStore } from "@/features/editor" ;
9- import { usePage } from "@/features/pageSidebar" ;
109import { createSocketIOProvider } from "@/shared/api" ;
1110
1211export 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,
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments