Closed lonagi closed 6 months ago
Upd: changed to this code:
// ccEmails.$patch((state) => {
// state.all.push('')
// })
ccEmails.all.push('')
ccEmails.all = [...ccEmails.all]
but it still return error. It seems I cannot modify state at all????. I also did next:
// Store file
...
return defineStore(id, () => {
const all = ref(null)
return { all }
})
...
ccEmails.all = [123]
doesn't work.
. Btw. If I call second time function to change state it returns "Cannot read properties of null (reading 'style')". (were insertBefore instead of style)
wtf?
I want notice that even on production of course it changes value of state if output it directly to {{ state }} in template, but doesn't change anything when I have div v-for which loops this state
When I fully deleted $patch function from my component and also changed to this code:
// ccEmails.$patch((state) => {
// state.all.push('')
// })
ccEmails.all.push('')
ccEmails.all = [...ccEmails.all]
I am getting another error:
5
entry.ecbe6a09.js:1 TypeError: Cannot read properties of null (reading 'push')
at g (ModalEmailSend.c23444bd.js:1:2923)
at l.length.o.onClick.e.<computed>.e.<computed> (ModalEmailSend.c23444bd.js:1:3797)
at Mo (entry.ecbe6a09.js:1:13641)
at wa (entry.ecbe6a09.js:1:13720)
at HTMLButtonElement.n (entry.ecbe6a09.js:1:75130)
l4 @ entry.ecbe6a09.js:1
// (ModalEmailSend.c23444bd.js:1:2923)
/// ...
function O(c) {
b.attachFiles.splice(c, 1)
}
const _ = Q()
, i = X()
, p = Y();
function g(c) {
c == "cc" && i.all.push("") // <------
}
// ....
so i cannot work with arrays.?
Reproduction
https://play.pinia.vuejs.org/#eNqNVMtu2zAQ/BVCKCAFiKkGaXMI7MBJkEN7aIvG6KXsQaZWNhOKJEjKcWDo37uiHpYdN6hOFHdmdzjk7i66NYZuKoiuo6njVhhPHPjKEJmp1YxF3rHohilRGm092ZHKwT1/KDMhH722QGpSWF2SmKZC5bCl3sVMMcW1cp5w3oJmx7TkrAEVleJeaEVM5da/MllBUgiQ+eLVwBnZMUXwEwXZ75LZjMScx0O0+boq9IPJPF8nifOZR/7sZgxqvhCgmZS0KZjEMaroY3W3rglTNVPTtDUDj44/HkojkYt/hEyXlfcoes6l4M9o0V59kIZ+3VqbvZLdrleGJet6mrZETDJNh4zRedR6OykzQ5+cVngTQTfrAngB1/1JsJhQImt2WJSGNQVXTpZWvziwyGfReQ+d47WmOWy81tJNMiNa2tp7467TlOcK8TlIsbFUgU+VKdM3nPkV/UwvUimWKRbqLvmgDDImOZT/k72Hzj/Si0/0KmTdXHZJyyZrkxTtr9EW7/ARFWJ1ZArXpRES7HfTPJ1Dc9Bn/fI17HlbwSCRr4E/n9h/cttW9Q8LaN8GRsfymV2Bb8MPj99gi+shWOq8koh+J/gTnJZVo7GF3VUqR9kjXFD7JdyxUKuFe9h6UK4/VCM0uBHwweb7d46+l3tJL0cu9l2JBg49nEMhFBz2b3hL2LoDyEIxBLF26OqhYbkFfLyjfhb50JIWx4dV4yIYPSfJcUe2IwJNwPGAxZLff8JQ6MNdml1A4GH6JsUlU7ANKtsUOFsWejSSZm/lxb4FuKblj8kH8+wUmbeAk+S7Lvhv9nJMZyqq/wKgRtMz
Steps to reproduce the bug
playground on reproduction doesn't matter, because it is dev mode.
Expected behavior
On dev it pushes value inside state
Actual behavior
Additional information
Store file
Packages.json