Skip to content

Commit

Permalink
UIU-3290: Fix issue with Proxy borrower field value (#2817)
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-blazhko authored Dec 3, 2024
1 parent 4c7f803 commit 553a2d1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* `useUserTenantRoles` supplies `tenantId` in all its queries. Refs UIU-3279.
* Leverage API supported sorting of columns on pre-registrations records list. Refs UIU-3249.
* Add permission to access users-keycloak delete method. Refs UIU-3282.
* Fix issue with `Proxy borrower` field value. Refs UIU-3290.

## [11.0.7](https://github.com/folio-org/ui-users/tree/v11.0.7) (2024-11-30)
[Full Changelog](https://github.com/folio-org/ui-users/compare/v11.0.6...v11.0.7)
Expand Down
5 changes: 4 additions & 1 deletion src/views/LoanDetails/LoanProxyDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,21 @@ class LoanProxyDetails extends React.Component {
resources: PropTypes.shape({
proxy: PropTypes.shape({
records: PropTypes.arrayOf(PropTypes.object),
hasLoaded: PropTypes.bool,
}),
}),
mutator: PropTypes.shape({
proxy: PropTypes.shape({
GET: PropTypes.func.isRequired,
reset: PropTypes.func.isRequired,
}).isRequired,
}).isRequired,
showErrorCallout: PropTypes.func.isRequired,
}

componentDidMount() {
if (this.props.id) {
this.props.mutator.proxy.reset();
this.props.mutator.proxy.GET()
.catch(() => {
this.props.showErrorCallout('ui-users.errors.proxyBorrowerNotFound');
Expand All @@ -51,7 +54,7 @@ class LoanProxyDetails extends React.Component {
}

render() {
if (this.props.id) {
if (this.props.id && this.props.resources.proxy.hasLoaded) {
return <KeyValue
label={<FormattedMessage id="ui-users.loans.details.proxyBorrower" />}
value={this.getUserFullName()}
Expand Down
10 changes: 8 additions & 2 deletions src/views/LoanDetails/LoanProxyDetails.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ const props = (propID, proxyID) => {
id: propID,
resources: {
proxy: {
records: [{ id: proxyID }]
records: [{ id: proxyID }],
hasLoaded: true,
}
},
mutator: {
proxy: {
GET: jest.fn().mockResolvedValueOnce(proxyData),
reset: jest.fn(),
},
},
showErrorCallout: showErrorMock,
Expand Down Expand Up @@ -56,11 +58,15 @@ describe('Render LoanProxyDetails component', () => {
const newprops = {
id: 'test',
resources: {
proxy: null
proxy: {
records: null,
hasLoaded: true,
},
},
mutator: {
proxy: {
GET: jest.fn().mockRejectedValueOnce(),
reset: jest.fn(),
},
},
showErrorCallout: showErrorMock,
Expand Down

0 comments on commit 553a2d1

Please sign in to comment.