Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

433
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!