IDE freezes after window regains focus with sketch on network drive

I am using Windows 10 and Arduino 1.8.13. If I alt+tab to the IDE now, it freezes for a few seconds. The text in the menu along the top is greyed out. Then it will come back and work. This only affects the main view and not the perferences screen, but closing the preferences screen has the same issue.

This only seems to affect a sketch on a network drive. Is there a solution?