"Might as well get yer uniform," said Hagrid, nodding toward Madam Malkin's Robes for All Occasions. "Listen, Harry, would yeh mind if I slipped off fer a pick-me-up in the Leaky Cauldron? I hate them Gringotts carts." He did still look a bit sick, so Harry entered Madam Malkin's shop alone, feeling nervous.
Madam Malkin was a squat, smiling witch dressed all in mauve.
"Hogwarts, dear?" she said, when Harry started to speak. "Got the lot here –– another young man being fitted up just now, in fact."
(Harry Potter and the Sorcerer's Stone)
It seems that ‘when’ has the meaning of OALD’s conjunction #4: “just after which”, He had just drifted off to sleep when the phone rang. In this explanation, would ‘which’ in ‘just after which’ refer to the previous clause: ‘he had just drifted to sleep’?
And in the example above, would it refer to ‘“Hogwarts, dear?” she said’?