From a8293784d2216c60803ad988c2e68e987838a355 Mon Sep 17 00:00:00 2001 From: Triston Date: Wed, 27 Mar 2024 22:29:18 -0500 Subject: [PATCH] undo ts ignore lines --- src/HomePage.tsx | 1 - src/components/Board.tsx | 1 - src/components/BoardEditor.tsx | 1 - src/components/ItemList.tsx | 4 ---- src/state/GlobalProvider.tsx | 13 +++++++++---- src/state/global.ts | 2 -- src/state/mouse.ts | 1 - 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/HomePage.tsx b/src/HomePage.tsx index b686238..8de6914 100644 --- a/src/HomePage.tsx +++ b/src/HomePage.tsx @@ -77,7 +77,6 @@ export function HomePage() { const data = await readFile(file) console.log("IMPORT", data) await JsonUtils.import(data) - //@ts-ignore window.location = "/" }, }) diff --git a/src/components/Board.tsx b/src/components/Board.tsx index 6af7b47..f184edf 100644 --- a/src/components/Board.tsx +++ b/src/components/Board.tsx @@ -55,7 +55,6 @@ export function Board({ boardId }: { boardId: string }) { (b) => String(b.id) === boardId || b.uuid === boardId ) if (!board) { - // @ts-ignore window.location = "/" return } diff --git a/src/components/BoardEditor.tsx b/src/components/BoardEditor.tsx index b68b3ae..463366d 100644 --- a/src/components/BoardEditor.tsx +++ b/src/components/BoardEditor.tsx @@ -181,7 +181,6 @@ function BoardTagEditor({ tag }: { tag: Tag }) { diff --git a/src/components/ItemList.tsx b/src/components/ItemList.tsx index e24a376..407306d 100644 --- a/src/components/ItemList.tsx +++ b/src/components/ItemList.tsx @@ -225,7 +225,6 @@ function Item({ item, idx, listId }: ItemProps) { const { clickedItem, setClickedItem, itemDragTarget, setItemDragTarget } = useGlobal() const { - // @ts-ignore value: { tags, itemTags }, removeItemTag } = useBoardTagsStore((state) => [ @@ -234,11 +233,8 @@ function Item({ item, idx, listId }: ItemProps) { ]) const itemItemTags: Array = useMemo(() => { - // @ts-ignore const tagsForThisItem = itemTags.filter((it) => it.itemId === item.id) - // @ts-ignore const mappedTags = tagsForThisItem.map((it) => { - // @ts-ignore const foundTag = tags.find((t) => t.id === it.tagId) if (!foundTag) { void removeItemTag(it) diff --git a/src/state/GlobalProvider.tsx b/src/state/GlobalProvider.tsx index b6df883..507aa57 100644 --- a/src/state/GlobalProvider.tsx +++ b/src/state/GlobalProvider.tsx @@ -9,12 +9,17 @@ import { loadBoards } from "../idb" export function GlobalProvider({ children }: { children?: JSX.Element[] }) { const [state, dispatch] = useReducer(globalStateReducer, defaultGlobalState) + + async function _loadBoards() { + const boards = await loadBoards() + dispatch({ type: "SET_BOARDS", payload: boards }) + + } + useEffect(() => { - ;(async () => { - const boards = await loadBoards() - dispatch({ type: "SET_BOARDS", payload: boards }) - })() + _loadBoards() }, []) + return ( diff --git a/src/state/global.ts b/src/state/global.ts index fed550e..0c9eb09 100644 --- a/src/state/global.ts +++ b/src/state/global.ts @@ -10,10 +10,8 @@ import { } from "../types" import { addBoard as addBoardDb } from "../idb" -// @ts-ignore export const GlobalCtx = createContext(null) export const GlobalDispatchCtx = - // @ts-ignore createContext<(action: GlobalDispatchAction) => void>(null) export function useGlobal() { diff --git a/src/state/mouse.ts b/src/state/mouse.ts index 0bf821c..9a5692a 100644 --- a/src/state/mouse.ts +++ b/src/state/mouse.ts @@ -6,6 +6,5 @@ type MouseContext = { setValue: (payload: Vector2) => void } -// @ts-ignore export const MouseCtx = createContext(null) export const useMouse = () => useContext(MouseCtx)