How to modify an array inside an object after mutation

Hello,
How to modify an array inside an object after mutation

 useMutation(ADD_FRIEND, {
        update(cache, { data }) {
           cache.modify({
                fields: {
                   getProfile( profile={}){  // prrofile={name:sting, friends=[]  other_fields... }

                   //how will update friend list when added or removed using mutation

                  return  profile // default state
                  }
               } 
          })
     }
}