(bug): fix type errors causing build failure #3

Merged
tristonarmstrong merged 1 commits from 1-bug-type-errors-causing-build-failure into main 2024-04-02 04:02:17 +00:00
4 changed files with 10 additions and 7 deletions
Showing only changes of commit 4970df30ba - Show all commits

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

@ -8,7 +8,7 @@ import { useListsStore } from "./lists"
export const useBoardStore = createStore( export const useBoardStore = createStore(
{ board: null as Board | null }, { board: null as Board | null },
function (set, get) { function(set, get) {
const selectBoard = async (board: Board) => { const selectBoard = async (board: Board) => {
const setTagsState = useBoardTagsStore.methods.setState const setTagsState = useBoardTagsStore.methods.setState
const setListsState = useListsStore.methods.setState const setListsState = useListsStore.methods.setState
@ -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)