How to create a transformer that transform some data based on other Firebase documents

I’m trying to create a table with a list of ideas. Each idea has some an array of values IDs. What I’m trying to do is:

  • Get the data from another collection (values)
  • Update the values data for each idea with the name of each values
  • Return a new object to display in a table

Here is the code I have so far on my transformer

  const values = {{getValues.data}}
  const result = data.map(i => {
    const newValues = i.values ? i.values.map(g => {
      const find = values.find(v => v._id === g)
      return find.name
    }) : []
  
    return {
      newValues: newValues.join(', '),
      ...i
    }
  })

  return result

But for some reasons I get some errors: Cannot read property map of null. My list of values works perfectly in another tables so I don’t understand what’s wrong here.

Am I doing something wrong? Any suggestions?

By the way, these errors appears only when loading the page. If I press ‘Run’ there’s no errors. Should I do some async/await ?