Just when I thought
This expression is used to indicate a sudden change right after a particular situation or action that was expected.
Examples
彼は来るかと思うと、急に休むことにした。
Just when I thought he would come, he suddenly decided to take a rest.
雨がやむかと思うと、また降り出した。
Just when I thought the rain stopped, it started again.
彼女は仕事を終えたかと思うと、もう寝てしまった。
Just when I thought she finished her work, she already fell asleep.
Quick check
彼は来る___、急に休むことにした。