diff --git a/package.json b/package.json index fd4bc73..1260e97 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "@kevisual/query": "0.0.15", "@kevisual/router": "0.0.9", "@kevisual/store": "workspace:*", + "@kevisual/query-mark": "workspace:*", "@mui/material": "^6.4.8", "antd": "^5.24.5", "clsx": "^2.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f09d98d..fb746ff 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,9 @@ importers: '@kevisual/query': specifier: 0.0.15 version: 0.0.15(ws@8.18.0) + '@kevisual/query-mark': + specifier: workspace:* + version: link:submodules/query-mark '@kevisual/router': specifier: 0.0.9 version: 0.0.9 diff --git a/src/modules/query.ts b/src/modules/query.ts new file mode 100644 index 0000000..75b1db4 --- /dev/null +++ b/src/modules/query.ts @@ -0,0 +1,9 @@ +import { QueryClient } from '@kevisual/query'; +import { QueryMark } from '@kevisual/query-mark'; + +export const queryClient = new QueryClient(); + +export const queryMark = new QueryMark({ + query: queryClient as any, + markType: 'mark', +}); diff --git a/src/pages/Draw.tsx b/src/pages/Draw.tsx index 32ae925..a3327ba 100644 --- a/src/pages/Draw.tsx +++ b/src/pages/Draw.tsx @@ -1,7 +1,7 @@ import { useEffect, useLayoutEffect, useRef, useState } from 'react'; -import { createMarkStore, store } from '../store'; +import { createMarkStore, store, useMarkStore } from '../store'; console.log('store', store); -import { StoreContextProvider, useStore } from '@kevisual/store/react'; +import { StoreContextProvider } from '@kevisual/store/react'; import { LineChart } from 'lucide-react'; import { useShallow } from 'zustand/shallow'; import { Core } from './core/Excalidraw'; @@ -27,26 +27,20 @@ export const Draw = () => { ); }; export const DrawHeader = () => { - const store = useStore( - useShallow((value: any) => { + const store = useMarkStore( + useShallow((value) => { return { mark: value.mark, setMark: value.setMark, setInfo: value.setInfo, + getList: value.getList, }; }), ); console.log('store show', store); - const init = useRef(false); useEffect(() => { - if (!init.current && store.mark) { - init.current = true; - store.setMark('1234'); - setTimeout(() => { - store.setMark('info4'); - }, 1000); - } - }, [store.mark]); + store.getList(); + }, []); return (