Skip to content

Commit e3fa196

Browse files
committed
revised name of updateReduxProjectTitle, updateReduxProjectTitleWithDefault
1 parent f4a9bfa commit e3fa196

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/lib/titled-hoc.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ const messages = defineMessages({
2121
const TitledHOC = function (WrappedComponent) {
2222
class TitledComponent extends React.Component {
2323
componentDidMount () {
24-
this.updateReduxProjectTitleWithDefault(this.props.projectTitle);
24+
this.handleReceivedProjectTitle(this.props.projectTitle);
2525
}
2626
componentDidUpdate (prevProps) {
2727
if (this.props.projectTitle !== prevProps.projectTitle) {
28-
this.updateReduxProjectTitleWithDefault(this.props.projectTitle);
28+
this.handleReceivedProjectTitle(this.props.projectTitle);
2929
}
3030
// if the projectTitle hasn't changed, but the reduxProjectTitle
3131
// HAS changed, we need to report that change to the projectTitle's owner
@@ -34,25 +34,25 @@ const TitledHOC = function (WrappedComponent) {
3434
this.props.onUpdateProjectTitle(this.props.reduxProjectTitle);
3535
}
3636
}
37-
updateReduxProjectTitleWithDefault (requestedTitle) {
37+
handleReceivedProjectTitle (requestedTitle) {
3838
let newTitle = requestedTitle;
3939
if (newTitle === null || typeof newTitle === 'undefined') {
4040
newTitle = this.props.intl.formatMessage(messages.defaultProjectTitle);
4141
}
42-
this.props.updateReduxProjectTitle(newTitle);
42+
this.props.onChangedProjectTitle(newTitle);
4343
}
4444
render () {
4545
const {
4646
/* eslint-disable no-unused-vars */
4747
intl,
4848
isShowingWithoutId,
49+
onChangedProjectTitle,
4950
// for children, we replace onUpdateProjectTitle with our own
5051
onUpdateProjectTitle,
5152
// we don't pass projectTitle prop to children -- they must use
5253
// redux value
5354
projectTitle,
5455
reduxProjectTitle,
55-
updateReduxProjectTitle,
5656
/* eslint-enable no-unused-vars */
5757
...componentProps
5858
} = this.props;
@@ -67,10 +67,10 @@ const TitledHOC = function (WrappedComponent) {
6767
TitledComponent.propTypes = {
6868
intl: intlShape,
6969
isShowingWithoutId: PropTypes.bool,
70+
onChangedProjectTitle: PropTypes.func,
7071
onUpdateProjectTitle: PropTypes.func,
7172
projectTitle: PropTypes.string,
72-
reduxProjectTitle: PropTypes.string,
73-
updateReduxProjectTitle: PropTypes.func
73+
reduxProjectTitle: PropTypes.string
7474
};
7575

7676
TitledComponent.defaultProps = {
@@ -86,7 +86,7 @@ const TitledHOC = function (WrappedComponent) {
8686
};
8787

8888
const mapDispatchToProps = dispatch => ({
89-
updateReduxProjectTitle: title => dispatch(setProjectTitle(title))
89+
onChangedProjectTitle: title => dispatch(setProjectTitle(title))
9090
});
9191

9292
return injectIntl(connect(

0 commit comments

Comments
 (0)