Skip to content

Commit d9587cc

Browse files
authored
Only resize minicharts if active tab is schema view (#806)
1 parent b47e629 commit d9587cc

File tree

1 file changed

+13
-0
lines changed
  • src/internal-packages/schema/lib/component

1 file changed

+13
-0
lines changed

src/internal-packages/schema/lib/component/index.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const app = require('hadron-app');
22
const React = require('react');
3+
const SchemaActions = require('../action');
34
const SchemaStore = require('../store');
45
const StateMixin = require('reflux-state-mixin');
56
const Field = require('./field');
@@ -24,12 +25,24 @@ const Schema = React.createClass({
2425
this.StatusAction = app.appRegistry.getAction('Status.Actions');
2526
this.StatusRow = app.appRegistry.getComponent('App.StatusRow');
2627
this.queryBar = app.appRegistry.getComponent('Query.QueryBar');
28+
this.CollectionStore = app.appRegistry.getStore('App.CollectionStore');
2729
},
2830

2931
shouldComponentUpdate() {
3032
return true;
3133
},
3234

35+
componentDidUpdate() {
36+
// when the namespace changes and the schema tab is not active, the
37+
// tab is "display:none" and its width 0. That also means the the minichart
38+
// auto-sizes to 0. Therefore, when the user switches back to the tab,
39+
// making it "display:block" again and giving it a proper non-zero size,
40+
// the minicharts have to be re-rendered.
41+
if (this.CollectionStore.getActiveTab() === 0) {
42+
SchemaActions.resizeMiniCharts();
43+
}
44+
},
45+
3346
/**
3447
* updates the progress bar according to progress of schema sampling.
3548
* The count is indeterminate (trickling), and sampling/analyzing is

0 commit comments

Comments
 (0)