Maybe you had Magisk patched to Recovery - then obviously, flashing TWRP takes over the MagiskMessed up I don't think because I just updated from go to advanced install recovery ram disk and flash the latest twrp. Magisk says "Ramdisk Yes".
But for Xiaomi devices, even when Magisk app reports Ramdisk No, you should still flash Magisk to Boot, not to Recovery and you will have no problem with TWRP vs Magisk
What is your device and how do you install Magisk?