OK now I understand.
Finding the source of EMI (ElectroMagnetic Interference) can be difficult and finding a solution also difficult. If the ESP is close to the fan motor or AC wiring or your PCB layout has the AC lines close to the ESP32, then snubbers may not help. I have no design experience with AC snubbers, so I can't help you there.
You might try shielding the ESP32 board with metal and connecting a 100uF capacitor in parallel with a 0.1uF capacitor between Vin and ground, close to the ESP32.
Sorry I can't do more.