I am doing a funded PhD in humanities and don't really enjoy what I am doing (the topic and area). I applied for another PhD and got admitted. The problem is that I need to apply for visa and wait a few months to see if I'll be granted visa. I don't want to leave my current position before I know I have the visa (don't want to lose everything and don't want to be forced to go back to my home country as I'm on student visa here).
The question is when and how should I tell my advisor that I'm leaving?