Skip to content

Commit

Permalink
FIX: History viewer pagination fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfendeksilverstripe committed Jan 14, 2025
1 parent 7b200e2 commit aa351e9
Show file tree
Hide file tree
Showing 5 changed files with 2,697 additions and 3,020 deletions.
6 changes: 3 additions & 3 deletions client/dist/js/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/styles/bundle.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions client/src/components/HistoryViewer/HistoryViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { versionType } from 'types/versionType';
import { compareType } from 'types/compareType';
import classNames from 'classnames';
import ResizeAware from 'components/ResizeAware/ResizeAwareHoc';
import ResizeAware from 'components/ResizeAware/ResizeAware';
import * as viewModeActions from 'state/viewMode/ViewModeActions';
import PropTypes from 'prop-types';

Expand Down Expand Up @@ -49,8 +49,13 @@ class HistoryViewer extends Component {
* @param {object} prevProps
*/
componentDidUpdate(prevProps) {
if (!this.props.actions || !this.props.actions.versions) {
return;
}

const { page: prevPage } = prevProps;
const { page: currentPage, actions: { versions } } = this.props;
const { page: currentPage } = this.props;
const { actions: { versions } } = this.props;

if (prevPage !== currentPage && typeof versions.goToPage === 'function') {
versions.goToPage(currentPage);
Expand All @@ -64,7 +69,7 @@ class HistoryViewer extends Component {
componentWillUnmount() {
const { onSelect } = this.props;
if (typeof onSelect === 'function') {
onSelect(false);
onSelect(0);
}
}

Expand Down Expand Up @@ -357,6 +362,7 @@ class HistoryViewer extends Component {
compare,
compare: { versionFrom: hasVersionFrom },
} = this.props;

return (
<div className={this.getContainerClasses()}>
<CompareWarningComponent />
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@
"@apollo/client": "^3.7.1",
"bootstrap": "^4.6.2",
"classnames": "^2.3.2",
"create-react-class": "^15.7.0",
"graphql": "^16.6.0",
"graphql-fragments": "^0.1.0",
"graphql-tag": "^2.12.6",
"griddle-react": "^1.13.1",
"griddle-react": "^0.8.2",
"jquery": "^3.5.0",
"moment": "^2.21.0",
"popper.js": "^1.14.4",
Expand Down
Loading

0 comments on commit aa351e9

Please sign in to comment.