Skip to content

Commit 5c57e14

Browse files
committed
MT: Microvolunteering loop hangs browser
1 parent 45b516d commit 5c57e14

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

store/microvolunteering.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ export const mutations = {
2121
}
2222
},
2323

24+
addList(state, list) {
25+
state.list = {}
26+
27+
if (list) {
28+
for (const item of list) {
29+
Vue.set(state.list, item.id, item)
30+
}
31+
}
32+
},
33+
2434
clear(state) {
2535
state.list = {}
2636
},
@@ -48,10 +58,7 @@ export const actions = {
4858
microvolunteerings
4959
} = await this.$api.microvolunteering.fetch(params)
5060

51-
microvolunteerings.forEach(m => {
52-
commit('add', m)
53-
})
54-
61+
commit('addList', microvolunteerings)
5562
return context
5663
},
5764

0 commit comments

Comments
 (0)