Skip to content

Commit adcbc14

Browse files
remove hard-coding
1 parent 2e90370 commit adcbc14

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

classes/Visualizer/Gutenberg/build/block.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/Visualizer/Gutenberg/src/Components/Charts.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ class Charts extends Component {
3939
this.state = {
4040
charts: null,
4141
isBusy: false,
42-
chartsLoaded: false
42+
chartsLoaded: false,
43+
perPage: visualizerLocalize.chartsPerPage
4344
};
4445
}
4546

@@ -54,7 +55,7 @@ class Charts extends Component {
5455
async loadMoreCharts() {
5556
const offset = ( this.state.charts ).length;
5657
let chartsLoaded = this.state.chartsLoaded;
57-
const perPage = visualizerLocalize.chartsPerPage;
58+
const perPage = this.state.perPage;
5859

5960
this.setState({ isBusy: true });
6061

@@ -73,7 +74,7 @@ class Charts extends Component {
7374

7475
render() {
7576

76-
const { charts, isBusy, chartsLoaded } = this.state;
77+
const { charts, isBusy, chartsLoaded, perPage } = this.state;
7778

7879
return (
7980
<div className="visualizer-settings__charts">
@@ -159,7 +160,7 @@ class Charts extends Component {
159160
}) }
160161
</div>
161162

162-
{ ! chartsLoaded && 5 < charts.length && (
163+
{ ! chartsLoaded && perPage - 1 < charts.length && (
163164
<Button
164165
isPrimary
165166
isLarge

0 commit comments

Comments
 (0)