Skip to content

Commit

Permalink
update DataFetcher tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnC-80 committed Sep 20, 2023
1 parent 1df2de8 commit f00d1aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/DataFetcher/DataFetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,15 @@ export class DataFetcher extends Component {
};

componentDidMount() {
const { resources:{ splitStatus } } = this.props;
const { statusLoaded } = this.state;
this.mounted = true;
this.initialFetchPending = false;
if (!statusLoaded && splitStatus?.hasLoaded) {
this.setState({ statusLoaded: true }, () => {
if (!this.initialFetchPending) this.initialize();
});
}
}

componentDidUpdate(props, state) {
Expand Down
6 changes: 6 additions & 0 deletions src/components/DataFetcher/DataFetcher.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ const resources = buildResources({
fileName: 'testFileName',
}],
}],
otherResources: {
splitStatus: {
hasLoaded: true,
records: [{ splitStatus: true }]
}
}
});

const TestComponent = () => {
Expand Down

0 comments on commit f00d1aa

Please sign in to comment.