Diffraction is an optical effect. It's immutable. It cannot be avoided unless and until someone comes up with a lens that doesn't use any optical elements or an aperture to control light. Since both these things are impossible, there's nothing that can be done about diffraction other than to avoid using "too small" apertures.
Diffraction causes the loss of fine detail, which can make an image look "soft" and objects appear "plasticky". You can counteract it to some degree in post-processing with sharpening, but there's no recovering the fine detail that was lost. It's gone and there's no getting it back.
The best solution is to use "not too small"r aperture and deal with any lack of depth of field using other means, such as focus stacking an image. That technique is pretty much limited to stationary objects, so it generally won't work with live subjects or anything else that moves such as ocean waves or wind blown foliage.
Sensor size is an indirect factor effecting the appearance of diffraction. The smaller the sensor, the more diffraction will be a problem in any given size of print (or any other use of an image). This is simply because to finish an image from a smaller sensor requires greater magnification.
And, the higher resolution the camera's sensor, the more diffraction will occur. Or, one might say, the more obvious it will be. Basically, more detail is being captured by the sensor, so there is more to lose to the optical effect. (To some extent, the same might be true of higher resolution lenses. I really don't know.) But, also and importantly, the higher image resolution, the larger and more critically you will be viewing it on a computer screen if you view all images "at 100%". A 12MP image "at 100%" is half as large as a 24MP image at the same magnification... or you might say you are viewing the higher resolution image "more critically".
Print size (or other usage of the image) is a factor, as would be any cropping. There's going to be a difference viewing a billboard from 100 feet versus viewing an 8x10" print from one foot.
For comparison's sake, the following Diffraction Limited Aperture (DLA) is based upon viewing images at 100% on a typical computer monitor (native resolution around 100 ppi). Take into consideration that this IS NOT how most people will ever view the image. In most cases it's a great deal more magnified.Also, the "DLA" is the aperture at which diffraction first begins to occur visibly at that magnification. The effect will increase incrementally as you stop down to smaller apertures. It's usually quite apparent one or two stops smaller than the DLA.
CX or 1" sensor with 15MP... f/4.4
M4/3 camera with 15MP... f/6
APS-C camera with 15MP... f/6.9
Full frame with 15MP... f/11.4
CX or 1" sensor with 20MP... f/3.8
M4/3 camera with 20MP... f/5.2
APS-C camera with 20MP... f/5.9
Full frame camera w/ 20MP... f/9.9
APS-C sensor with 24MP... f/5.4
Full frame sensor w/24MP... f/9
APS-C sensor with 30MP... f/4.9
Full frame sensor, 30MP... f/8.1
Medium format, 30MP... f/14
Full frame sensor, 50MP... f/6.2
Medium format, 50MP... f/10.8
Full frame, 70MP... f/5.3
Medium format, 70MP... f/9.1
The above are approximations of current formats and resolutions. For example, there are full frame cameras with 46MP and 61MP sensors. None currently has 70MP, but there are strong rumors of models in the near future that will have higher resolution than that. Medium format digital are available in 100MP and higher resolution, too.
There is considerably more detail about diffraction here:
https://www.cambridgeincolour.com/tutorials/diffraction-photography.htm