When BatchedMesh uses setGeometryAt, replacement does not take effect

Demo
When you click on the scene’s model and use setGeometry, nothing happens. Is there something wrong with the way I use it?

  1. To use the geometry’s colors attribute you need to set the material’s vertexColors property:
const material = new MeshBasicMaterial({ vertexColors: true });
  1. The initial geometry has no color attribute, you need initiate it then update it:
// const box = new BoxGeometry(3, 3, 3);
// To 
const box = updateGeometryColor(new BoxGeometry(3, 3, 3), 0x00ff00);

Here is the jsfiddle

Thanks for your reply, the example works fine