willLeave and willChangeContext events