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(() => {
if (!boardsLoaded) return
const board = boards.find(
const board = boards?.find(
(b) => String(b.id) === boardId || b.uuid === boardId
)
if (!board) {

View File

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

View File

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

View File

@ -6,5 +6,8 @@ type MouseContext = {
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)