Skip to content

Commit

Permalink
Fix incorrect parameters going into loadObjectFromApi method.
Browse files Browse the repository at this point in the history
Now works with nextProps instead of this.props in componentWillReceiveProps
  • Loading branch information
HendrikThePendric committed Mar 20, 2018
1 parent f4db16c commit b8d1f09
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/sharing/src/SharingDialog.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SharingDialog extends React.Component {
componentDidMount() {
this.loadDataSharingSettings();
if (this.props.open && this.props.type && this.props.id) {
this.loadObjectFromApi();
this.loadObjectFromApi(this.props);
}
}

Expand All @@ -53,11 +53,11 @@ class SharingDialog extends React.Component {

if (hasChanged('id') || hasChanged('type')) {
this.resetState();
if (nextProps.open) this.loadObjectFromApi();
if (nextProps.open) this.loadObjectFromApi(nextProps);
}

if (!this.props.open && nextProps.open) {
this.loadObjectFromApi();
this.loadObjectFromApi(nextProps);
}
}

Expand Down Expand Up @@ -119,9 +119,8 @@ class SharingDialog extends React.Component {
});
}

loadObjectFromApi = () => {
loadObjectFromApi = ({ type, id }) => {
const api = this.props.d2.Api.getApi();
const { type, id } = this.props;

api
.get('sharing', { type, id })
Expand Down

0 comments on commit b8d1f09

Please sign in to comment.