Query history on opening dropdown