Vuex Mutation: Cannot read properties of undefined (reading 'Id')

I seem to be running into an odd problem. I have a mutation that removes an object from two different arrays in my state. It works fine most of the time, I add them and remove them with my buttons. But after I've done it 4 - 5 times (a random amount of times it seems), the next time I click it I get the error:

500
Cannot read properties of undefined (reading 'Id')

Console:

TypeError: Cannot read properties of undefined (reading 'Id')
at eval (mutations.js?014a:69:1)
    at Array.find (<anonymous>)
    at Store.BOOKING_REMOVE_SESSION (mutations.js?014a:68:1)
    at wrappedMutationHandler (vuex.esm.js?2f62:844:1)
    at commitIterator (vuex.esm.js?2f62:466:1)
    at Array.forEach (<anonymous>)
    at eval (vuex.esm.js?2f62:465:1)
    at Store._withCommit (vuex.esm.js?2f62:624:1)
    at Store.commit (vuex.esm.js?2f62:464:1)
    at Store.boundCommit [as commit] (vuex.esm.js?2f62:409:1)

My mutation:

BOOKING_REMOVE_SESSION: (state, sessionData) => {
  state.performBooking.sessions.find((o,i) => {
    if(o.Id === sessionData.Id){
      state.performBooking.sessions.splice(i, 1)
    } 
  })

  let sessionIndex = state.currentShow.sessions.findIndex(x => x.Id === sessionData.Id)
  state.currentShow.sessions[sessionIndex].activated = false;

}

It seems to do exactly what I want except when it errors. I think it has something to do with when there are a few things in the state.performBooking array. I reckon the problem is with o.Id === sessionData.Id not being able to find a matching ID for some reason.

It's used in conjunction with a button that calls a method:

  removeSession(sessionData) {
      this.$store.commit('BOOKING_REMOVE_SESSION', sessionData)
    }

A sample piece of data would be:

    {
      attributes: [Object],
      Id: 'a1g960010000sJSAAY',
      Capacity__c: 5,
      Performance__c: 'a1f960001000HMZAA2',
      Name: 'Test Performance #041',
      Time__c: '2021-11-19T15:00:00.000+0000',
      Version__c: 'General'
    },

Any help would be greatly appreciated cheers.

Updated 2022-01-14 12:55:28Z by Jack Sumner