Sprite animation problem⁷

I am coding a 2d rpg that loads/destroys maps in chunks. The first time the chunk is loaded the code below works. When the chunk is reloaded(same code as first load), the chest animation does not play, but everything else works. I’ve narrowed it down to the qq.push(chestID) line. If I comment it out the animation plays.

export function openChest(player, chest){
  let chestID = chest.getData('chest_id');
  let chestsCollected = this.registry.get('chestsCollected');
  if(!chestsCollected.includes(chestID) && this.jButtonA.pressed){
    let qq = this.registry.get('chestsCollected');

Here is how I am triggering openChest function.

scene.physics.add.overlap(scene.halo, chests, scene.openChest, null, this);

I also tried with the same results, everything works but the animation does not play. The chests show the initial sprite.

Phaser.Utils.Array.Add(qq, chestID);

I solved this by adding an opened flag to the chest and checking against it instead of checking the registry, which seems like it makes more sense. Setting the registry may have happened faster than the animation.