I've had the same problem on my Macbook Pro Retina 2017 when connecting an external hard drive through a dongle.
That Mac has two thunderbolt ports, one very close to the other. I've managed to solve the issue by unplugging my dongle from the port closest to display and plugging it into a port that's a bit farther from display.
I've read here that the reason for this problem may be that HDD is stealing power from WiFi when hardware is too close to each other, or something like that. Anyway, plugging it into another port solved the issue for me.
UPDATE: It seems like the solution was a one-time. If that doesn't work, try plugging your laptop into power. Maybe even moving an extern disk as far away as possible from mac. Plugging into power solved it for me this time.