when that happens to me I tell myself “this is THEIR mental illness on display and they are trying to give it to you. It is not YOUR mental illness: you have enough on your plate without carrying THEIRS too.
give them space to have their mental illness
it is theirs and belongs to them. Let them have it. It is not yours.