Merge pull request #3 from Klectr/1-bug-type-errors-causing-build-failure

(bug): fix type errors causing build failure
This commit is contained in:
Triston Armstrong 2024-04-01 23:02:17 -05:00 committed by GitHub
commit b4336a74b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 7 deletions

View File

@ -51,7 +51,7 @@ export function Board({ boardId }: { boardId: string }) {
useEffect(() => { useEffect(() => {
if (!boardsLoaded) return if (!boardsLoaded) return
const board = boards.find( const board = boards?.find(
(b) => String(b.id) === boardId || b.uuid === boardId (b) => String(b.id) === boardId || b.uuid === boardId
) )
if (!board) { if (!board) {

View File

@ -20,7 +20,7 @@ export function BoardEditorDrawer() {
const { boardEditorOpen, setBoardEditorOpen } = useGlobal() const { boardEditorOpen, setBoardEditorOpen } = useGlobal()
return ( return (
<Transition <Transition
in={boardEditorOpen} in={!!boardEditorOpen}
timings={[40, 150, 150, 150]} timings={[40, 150, 150, 150]}
element={(state) => element={(state) =>
state === "exited" ? null : ( state === "exited" ? null : (

View File

@ -29,7 +29,7 @@ export const useBoardStore = createStore(
const board = get().board! const board = get().board!
const newBoard = { ...board, ...payload } const newBoard = { ...board, ...payload }
const res = await db.updateBoard(newBoard) const res = await db.updateBoard(newBoard)
updateBoards(boards.map((b) => (b.id === res.id ? newBoard : b))) updateBoards(boards?.map((b) => (b.id === res.id ? newBoard : b)) ?? [])
set({ board: res }) set({ board: res })
} }
const deleteBoard = async () => { const deleteBoard = async () => {
@ -52,7 +52,7 @@ export const useBoardStore = createStore(
db.deleteBoard(board), db.deleteBoard(board),
]) ])
updateBoards(boards.filter((b) => b.id !== board.id)) updateBoards(boards?.filter((b) => b.id !== board.id) ?? [])
set({ board: null }) set({ board: null })
navigate("/") navigate("/")
} }
@ -60,7 +60,7 @@ export const useBoardStore = createStore(
const { boards, updateBoards } = useGlobal() const { boards, updateBoards } = useGlobal()
const board = get().board! const board = get().board!
const newBoard = await db.archiveBoard(board) const newBoard = await db.archiveBoard(board)
updateBoards(boards.map((b) => (b.id === board.id ? newBoard : b))) updateBoards(boards?.map((b) => (b.id === board.id ? newBoard : b)) ?? [])
navigate("/") navigate("/")
} }
const restoreBoard = async () => { const restoreBoard = async () => {

View File

@ -6,5 +6,8 @@ type MouseContext = {
setValue: (payload: Vector2) => void setValue: (payload: Vector2) => void
} }
export const MouseCtx = createContext<MouseContext | null>(null) export const MouseCtx = createContext<MouseContext>({
current: { x: 0, y: 0 },
setValue: (_payload: Vector2) => { }
})
export const useMouse = () => useContext(MouseCtx) export const useMouse = () => useContext(MouseCtx)