There are no rules (RAW or RAI) for this, thus it is the DM's decision
There are also no general rules that says or even implies that magic items lose their magic when broken. There are specific rules for artifacts and the like, but nothing for magic items in general. As such, this is a DM decision. If a magic sword is cracked somehow, the DM decides if the sword loses its magic entirely or if it is completely mundane now.
Chris Perkins (story designer for D&D) has suggested that magic items stop functioning when broken:
What happens if an Eversmoking Bottle is broken? Does the smoke cloud expand on and on forever?
If a magic item breaks, it ceases to function. The eversmoking bottle would stop producing smoke.
The fact that magic items stop functioning when broken makes sense, but that is not the same thing as magic items losing their magical nature necessarily. Also note that Chris is not an official source for RAW or even RAI, so at best this is just advice from a very experienced DM.
In the end there are no rules that cover this. A DM must decide for themselves what way they wish to handle broken magic items. In my experience, this does not come up almost ever but that may vary from table to table.