When you compile, the instance shown in the BP viewport and in the level is respawned to refresh the instance.
A solution to this is to have a variable for the static mesh asset and in the constructor, after spawning the default static mesh component, set the static mesh asset. That way, when compiling, your static mesh component will always be generated with the static mesh asset you provided it.
Though, I don’t know what are the possible drawbacks in memory, so you might wanna have a soft object reference to the asset, so when loading the class data in memory, it shouldn’t load the asset as well.