'〜とき': Tense Agreement in Temporal Clauses (When...)
Dictionary Form + とき (Action not yet completed) / Ta-form + とき (Action already completed)
When using '〜とき' (when), the tense of the verb preceding 'とき' indicates completion relative to the main action: (1) Dictionary Form + とき indicates that the action in clause 1 has NOT yet occurred when clause 2 happens ('日本へ行くとき、チケットを買いました' - When going to Japan, I bought tickets [bought tickets BEFORE departure]). (2) Ta-form + とき indicates that clause 1 was COMPLETED before clause 2 happens ('日本へ行ったとき、カメラを買いました' - When I went to Japan, I bought a camera [bought camera AFTER arrival in Japan]).
⚠ Note: A classic JLPT testing point: '行くとき' = before going; '行ったとき' = after arriving. Nouns take 'の' (子供のとき); na-adjectives take 'な' (暇なとき); i-adjectives take 'い' (若いとき).
日本へ行くとき、かばんを買いました。
When I was about to go to Japan, I bought a bag (bought bag before going).
日本へ行ったとき、着物を買いました。
When I went to Japan, I bought a kimono (bought kimono after arriving).