Glad to hear that's working for you.
Unfortunately I've been using a Monoprice 8K Certified Ultra High Speed HDMI 2.1 Cable on one of my LG UltraFine UHD 27-Inch 4K 2160p monitors since purchasing our Mac Mini M4 and am still encountering the random blackout issue.
Currently I'm using that HDMI cable on the #2 monitor and an Anker USB C Display/USB 4 Data Cable (40Gbps, 8K HD) on the #1 monitor. Per another member's suggestion I switched the USB C cable to the Thunderbolt port on the Mac Mini M4 and no longer encounter the random blackout issue on #1.
So the problem "moved" from the #1 to the #2 monitor. Less annoying since I use the #1 monitor primarily, but still...
As mentioned previously, I've tried all sorts of cables, connections, monitor setup configurations, etc. and the random blackout problem persists. What I have now is the most stable, but it's still there.
Reported the issue to Apple a while back.