Walking through a doorway can make you forget what you came to do even when you travel the same distance and return to the original room, because the brain treats a boundary as the end of one event and begins organising the next before the old intention has followed you through
The 'doorway effect' says crossing a threshold makes you forget, because the brain files experience into events and a boundary closes one off. It's a real finding, though a 2021 replication suggests it is smaller and more load-dependent than the popular version.