Expresses a near miss or a situation that almost happened; 'was just about to', 'almost', 'nearly'.
Verb-te form + いるところだった, い-Adjective + ところだった, な-Adjective + なところだった, Noun + のところだった
Long explanation:
The ~ところだった grammar point is used to express a situation that almost occurred or something that the speaker was just about to do. It can be translated as 'was just about to', 'almost', or 'nearly' in English. The formation differs depending on whether it is used with a verb, い-adjective, な-adjective, or noun.