What you're describing is, unfortunately, a very typical dementia 'thing' and ridiculously, it's one of those things that no information leaflet, or advice from any agencies or authorities offering 'support' ever mentions explicitly.
There's a behavioural response that you will hear called 'hosting' or 'show-boating' where the person with dementia is all smiles and appears completely lucid when company arrives, but is exhausted, confused and unable to process their emotions when they (finally!) leave.
This is something that really angers me about the way advice on dementia is so much of a drip-feed for us family carers! It's something pretty damn fundamental to our ability to build our own resilience and manage and inform relationships with friends and wider family and yet where is it accurately and honestly described? Usually only in response to posts like yours.
The truth is that some family and friends will just never really understand and unwittingly rub salt in the wounds by trumpeting about how pleased your PWD was to see them and how well they looked and how much they enjoyed seeing them again. You learn eventually to grit your teeth and smile politely!
Others do a fabulous disappearing act, or make up creative reasons for not visiting, like, "the house is on a really bad corner and we don't like to park there". Instead of saying, "the rest of the road is straight and there's a free car park opposite - duh!" you learn to nod and accept that they just can't deal with the situation right now.
You can only mange dementia one hour at a time, let alone one day at a time and some days, bitterly hard though it is, you have to accept there's literally nothing you can do to bring your PWD back in that moment. You can manage dementia by keeping to routines and learning to look for the signs in posture, mood and expression that signal a change for the worse. I had to learn to shut up! Before mum was diagnosed, I would try to reason with her and talk her out of it. Now I know sometimes, watchful silence is sometimes best and a good sleep can rectify an awful lot.