Shader Compilation - onCompiled

Not sure if it is a bug, though technically it is not. It is about recompiling shaders.

Basically I have code that requires shaders to be recompiled. It is a RayMarching Modeller so everytime you add or remove objects a new shader needs to be created.

I display a message when the new code is created “Compiling please wait”. On compiled the message is cleared. I also track changes and only compile if the objects added to the shape will effect the shader code.

The trouble occurs when a change is done that results in an identical code to what was compiled and is still cached. At this point BABYLON.js rightly does not recompile the code as why waste all that processing power trouble is (rightly again I suppose) it does not trigger the onCompiled situation and therefore the message box is not dismissed.

There is a ready flag which I am trying out attached to the material maybe that will work. But would be nice if there was an onReady event trigger or some such. Am I missing something?

Further Update:
If I add the following command after the construction of the shader where sh is the shader, but BEFORE it is attached to any mesh:

console.log(sh.isReady());

The shader fails to display. Taking this line out and the objects reappear. Very weird as there are no error messages of any kind. It is as though the isReady() feature destroys the material if it is not attached to a mesh.