If I can give my two cents here, always do the gapping before tuning, if you have to. I noticed that most of the times when the gap changes, the tuning changes too. Maybe you have to do the gapping again after the tuning but the difference will be minimal.
Another thing, for me it was more efficient to emulate the conditions when I play before work on tuning. As I always play for a long amount of time with the same melodica, it collects a great amount of moisture. It would be better to play it for a while and do some tuning just after, always playing again for a few minutes to check the tuning, after close the reed chamber. There are players that changes between some melodicas in one presentation, playing two or three songs with the same melodica. It is a smart strategy but much more expensive, hahaha. So they can do the tuning with the melodica dry inside.
Finally, the tuning can change when the melodica is outside the body. I really don’t know how to explain (sorry about my english), but I noticed that with some models, the tuning is different when you only close the reeds chamber (if your melodica does have one) and close the melodica entirely, with all the parts. So, it’s nice to check with the melodica all assembled to know if the tuning is as you want to.