Sometimes we can’t avoid context switching. We may have many projects on the go, or there may be a fire (or multiple) that we need to attend to.
When this happens I try to stay on one topic long enough to either (a) get to a resolution, or (b) get a clear next step where either I, or someone else working on the project, is unblocked to make more progress.
Switching before getting to either (a) or (b) leads to spinning wheels and little progress.