Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

310
Visualizações
In Vue3, how to convert Nested Proxy Objects (Reactive data) to regular objects?

I have a pinia store that has a user object..

export const useStore = defineStore('store', {
  state: () => ({
    currentSlide: 1,
    user: {},
    data,
  }),
})

I am then updating it to have a an array vote inside the user object

And then the vote array has multiple objects as votes.. so I have the array as a user.vote which then is in this format [{vote:01},{vote:02}.{vote:3}]

I need to push this array to mongodb.. but when I try to access this array, as it's reactive data, it's a Proxy Object with multiple Proxy Objects inside of it..

So I tried toRaw(user.vote) (not sure if this is the right approach) and the array was no longer a Proxy but a regular array.. however the objects (votes) inside of it are still Proxy Objects..

How do I get a regular array with regular objects from this pinia structure to send to mongodb?

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda