Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

440
Vistas
TypeError: Cannot read properties of null (reading 'find')"

I'm trying to push an object to an array using vuex but i'm getting this error. I don't know why in Edge works great, but in Chrome and Opera it doesn't.

TypeError: Cannot read properties of null (reading 'find')"

Vuex store:

export default {
  namespaced: true,
  state: {
    shoppingCartItems: [], 
  },
  mutations: {
    SET_ITEM(state, payload) {
      if (state.shoppingCartItems.find(item => item.type === 'custom-item')) {
        state.shoppingCartItems.push(payload)
      } else if (state.shoppingCartItems.find(item => item.name === payload.name)) {
        const index = state.shoppingCartItems.findIndex(item => item.name === payload.name)
        const value = payload.quantity
        state.shoppingCartItems[index].quantity += value
      } else {
        state.shoppingCartItems.push(payload)
      }
    },
  }
}

In SET_ITEM I'm checking if the payload is an item that already is in the array so instead of adding again, it sums 1 to this specific item. And again, in Edge it's working perfectly, but in Chrome everything seems to be broken.

Example of payload that SET_ITEM is receiving:

payload = {
dimensions: "30x10cm"
extraLine: 2
extraQuote: "no"
frases: [__ob__: Observer]
image: ""
name: "custom-item"
namesQuantity: 1
names: [{…}, __ob__: Observer]
price: 180
quantity: 1
type: "custom-item"
}

enter image description here

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda