diff --git a/app/views/tree/_tree.html.haml b/app/views/tree/_tree.html.haml
index 439b4ec205f..cdd67929f7e 100644
--- a/app/views/tree/_tree.html.haml
+++ b/app/views/tree/_tree.html.haml
@@ -61,7 +61,7 @@
ajaxGet('#{@logs_path}');
});
-- if params[:path] && request.xhr?
+- if @path.present? && request.xhr?
:javascript
$(window).unbind('popstate');
$(window).bind('popstate', function() {