Skip to content

Commit

Permalink
Add hasLoaded prop
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-blazhko committed Dec 2, 2024
1 parent 431c4a9 commit b968361
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/views/LoanDetails/LoanProxyDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class LoanProxyDetails extends React.Component {
resources: PropTypes.shape({
proxy: PropTypes.shape({
records: PropTypes.arrayOf(PropTypes.object),
hasLoaded: PropTypes.bool,
}),
}),
mutator: PropTypes.shape({
Expand All @@ -45,7 +46,6 @@ class LoanProxyDetails extends React.Component {

getUserFullName() {
const proxy = (this.props.resources.proxy || {}).records || [];
console.log('proxy.length: ', proxy.length);
if (proxy.length === 1 && proxy[0].id === this.props.id) {
return <Link to={`/users/view/${this.props.id}`}>{getFullName(proxy[0])}</Link>;
}
Expand Down
9 changes: 7 additions & 2 deletions src/views/LoanDetails/LoanProxyDetails.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const props = (propID, proxyID) => {
id: propID,
resources: {
proxy: {
records: [{ id: proxyID }]
records: [{ id: proxyID }],
hasLoaded: true,
}
},
mutator: {
Expand Down Expand Up @@ -57,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 b968361

Please sign in to comment.