Skip to content

Commit

Permalink
fix: boards perf with shallow
Browse files Browse the repository at this point in the history
  • Loading branch information
mnenie committed Feb 13, 2025
1 parent 89b36fa commit fea9513
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/client/src/modules/boards/stores/boards.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { ref } from 'vue'
import { ref, shallowRef, triggerRef } from 'vue'
import { acceptHMRUpdate, defineStore } from 'pinia'
import type { Board, BoardRow } from '../types'

export const useBoardsStore = defineStore('boards', () => {
const boards = ref<BoardRow[]>([])
const boards = shallowRef<BoardRow[]>([])
const board = ref<Board>()

function removeBoards(idxs: string[]) {
idxs.forEach((id) => {
const index = boards.value.findIndex(board => board._id === id)
if (index !== -1) {
boards.value.splice(index, 1)
triggerRef(boards)
}
})
}

function addBoard(board: Board) {
boards.value.push(board)
boards.value = [...boards.value, board]
}

return {
Expand Down

0 comments on commit fea9513

Please sign in to comment.