R files are blank without me removing content

My R files seem to be blanking themselves(removing all content but not the file itself) whenever I open Rstudio.
I found that a few of my R files were completely the other day, with rstudio showing the file size as 0B and nothing appearing when I open them in notepad(so it is not the encoding).

As a result I started backing up all my files on google drive. One of my files appeared empty today again and when I checked it out in google drive a new blank file had been created whenever I opened rstudio. Is there anything that I can do to resolve this?

Similar issues were reported a time ago but the problem was solved in recent RStudio version, make sure you are using the latest version.