TileMap.convertLayerToStatic

I seem to be having a problem with the TileMap.convertLayerToStatic method.

I recently updated from Phaser 3 version 3.16.2 (I think) to version 3.17.0.

In my code I create a new blank dynamic tilemap layer, add it to my tilemap, fill it with some tiles and then convert the layer into a static tilemap layer.

Here is an extract of the code:

This part creates the dynamic tilemap layer and fills it with some tiles

let dynamicLayer = map.createBlankDynamicLayer(‘Flying_Thing_Platform_Layer’,
‘tileset’,0, 0, map.width, map.height, map.tileWidth, map.tileHeight);
flyingThingLayerData.forEach((rowObj, yIndex) =>
{
rowObj.forEach((tileIndex, xIndex) =>
{
dynamicLayer.putTileAt(tileIndex,xIndex, yIndex);
});
});

This part is where I convert the dynamic tilemap layer to a static tilemap layer

let staticLayer = map.convertLayerToStatic(dynamicLayer);

The problem I have is that after I have converted the dynamic tilemap layer into a static tilemap layer the tilemap layer data object that previously referenced the dynamic layer and now references the new static layer is removed from the layers array in the tilemap.

This did not happen with the earlier version of phaser3 that I was using and now I am getting errors in the console when I set collisions for the tiles in the static layer. Maybe I am doing something wrong and I should be setting collisions with the dynamic tilemap layer before I convert it to a static tilemap layer.