From 7c0e1992e1c777e567d63136dbaaa2a9933142b9 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Thu, 9 Apr 2015 14:18:27 -0700 Subject: [PATCH] Fix potential back button breaker --- src/kibana/components/doc_table/doc_table.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kibana/components/doc_table/doc_table.js b/src/kibana/components/doc_table/doc_table.js index 7d6d2fe438cef4..d2c04a69d24fc4 100644 --- a/src/kibana/components/doc_table/doc_table.js +++ b/src/kibana/components/doc_table/doc_table.js @@ -11,7 +11,7 @@ define(function (require) { require('components/doc_table/components/table_row'); require('modules').get('kibana') - .directive('docTable', function (config, Notifier) { + .directive('docTable', function (config, Notifier, getAppState) { return { restrict: 'E', template: html, @@ -57,7 +57,11 @@ define(function (require) { // This exists to fix the problem of an empty initial column list not playing nice with watchCollection. $scope.$watch('columns', function (columns) { - if (columns.length === 0) $scope.columns.push('_source'); + if (columns.length !== 0) return; + + var $state = getAppState(); + $scope.columns.push('_source'); + if ($state) $state.replace(); }); $scope.$watchCollection('columns', function (columns, oldColumns) {