4949 <GanttView v-else-if =" ! isEmpty && ! loading && viewMode === ' gantt' "
5050 key="gantt"
5151 :board =" board "
52- :stacks =" stacksByBoard " />
52+ :stacks =" stacks " />
5353 <div v-else-if =" !isEmpty && !loading"
5454 key =" board"
5555 ref =" board"
6262 @drag-start =" draggingStack = true "
6363 @drag-end =" draggingStack = false "
6464 @drop =" onDropStack " >
65- <Draggable v-for =" stack in stacksByBoard "
65+ <Draggable v-for =" stack in stacks "
6666 :key =" stack .id "
6767 data-click-closes-sidebar="true"
6868 data-dragscroll-enabled
8787
8888<script >
8989import { Container , Draggable } from ' vue-smooth-dnd'
90- import { mapState , mapGetters } from ' vuex'
90+ import { mapState as mapStateVuex , mapGetters } from ' vuex'
9191import Controls from ' ../Controls.vue'
9292import DeckIcon from ' ../icons/DeckIcon.vue'
9393import CheckIcon from ' vue-material-design-icons/Check.vue'
@@ -98,6 +98,8 @@ import GlobalSearchResults from '../search/GlobalSearchResults.vue'
9898import { showError } from ' ../../helpers/errors.js'
9999import { createSession } from ' ../../sessions.js'
100100import CardSidebar from ' ../card/CardSidebar.vue'
101+ import { mapActions , mapState } from ' pinia'
102+ import { useStackStore } from ' ../../stores/stack.js'
101103export default {
102104 name: ' Board' ,
103105 components: {
@@ -136,7 +138,8 @@ export default {
136138 }
137139 },
138140 computed: {
139- ... mapState ({
141+ ... mapState (useStackStore, [' stacksByBoard' ]),
142+ ... mapStateVuex ({
140143 isFullApp : state => state .isFullApp ,
141144 board : state => state .currentBoard ,
142145 showArchived : state => state .showArchived ,
@@ -146,14 +149,14 @@ export default {
146149 ' canManage' ,
147150 ' viewMode' ,
148151 ]),
149- stacksByBoard () {
150- return this .board ? .id ? this .$store . getters . stacksByBoard (this .board .id ) : []
152+ stacks () {
153+ return this .board ? .id ? this .stacksByBoard (this .board .id ) : []
151154 },
152155 dragHandleSelector () {
153156 return this .canEdit ? ' .stack__title' : ' .no-drag'
154157 },
155158 isEmpty () {
156- return this .stacksByBoard .length === 0
159+ return this .stacks .length === 0
157160 },
158161 },
159162 watch: {
@@ -180,16 +183,17 @@ export default {
180183 this .session ? .close ()
181184 },
182185 methods: {
186+ ... mapActions (useStackStore, [' loadStacks' , ' loadArchivedStacks' , ' createStack' , ' orderStack' ]),
183187 async fetchData () {
184188 this .loading = true
185189 try {
186190 await this .$store .dispatch (' loadBoardById' , this .id )
187- await this .$store . dispatch ( ' loadStacks' , this .id )
191+ await this .loadStacks ( this .id )
188192
189193 const routeCardId = this .$route ? .params ? .cardId ? parseInt (this .$route .params .cardId ) : null
190194 // If an archived card is requested, and we cannot find it in the current we load the archived stacks instead
191195 if (routeCardId && ! this .$store .getters .cardById (routeCardId)) {
192- await this .$store . dispatch ( ' loadArchivedStacks' , this .id )
196+ await this .loadArchivedStacks ( this .id )
193197
194198 if (this .$store .getters .cardById (routeCardId)) {
195199 this .$store .commit (' toggleShowArchived' , true )
@@ -208,15 +212,15 @@ export default {
208212 },
209213
210214 onDropStack ({ removedIndex, addedIndex }) {
211- this .$store . dispatch ( ' orderStack' , { stack: this .stacksByBoard [removedIndex], removedIndex, addedIndex })
215+ this .orderStack ( { stack: this .stacks [removedIndex], removedIndex, addedIndex })
212216 },
213217
214218 addNewStack () {
215219 const newStack = {
216220 title: this .newStackTitle ,
217221 boardId: this .id ,
218222 }
219- this .$store . dispatch ( ' createStack' , newStack)
223+ this .createStack ( newStack)
220224 this .newStackTitle = ' '
221225 },
222226
0 commit comments