Skip to content

Commit

Permalink
feat: adding array safety
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonNotJson committed Sep 12, 2023
1 parent 7d15560 commit 57b72ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/forum/src/components/Board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ const Board = ({ triggerRefresh, setBoard }: any) => {
(thread: Thread) => thread.board_id === boardId
)
: res.data.data;
setBoardThreads((prevBoardThreads) => [
setBoardThreads((prevBoardThreads = []) => [
...prevBoardThreads,
...threads,
...(Array.isArray(threads) ? threads : []),
]);

const endIndex: number = res.data.message;
Expand Down

0 comments on commit 57b72ab

Please sign in to comment.