Skip to content

Commit

Permalink
Fix potential back button breaker
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashid Khan committed Apr 9, 2015
1 parent a4f9bbd commit 7c0e199
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/kibana/components/doc_table/doc_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7c0e199

Please sign in to comment.