From f00d1aa6f7c506f7a58c62fb239262ea6ca2614c Mon Sep 17 00:00:00 2001 From: John Coburn Date: Wed, 20 Sep 2023 09:41:02 -0500 Subject: [PATCH] update DataFetcher tests --- src/components/DataFetcher/DataFetcher.js | 7 +++++++ src/components/DataFetcher/DataFetcher.test.js | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/components/DataFetcher/DataFetcher.js b/src/components/DataFetcher/DataFetcher.js index 540591e42..a6ed85834 100644 --- a/src/components/DataFetcher/DataFetcher.js +++ b/src/components/DataFetcher/DataFetcher.js @@ -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) { diff --git a/src/components/DataFetcher/DataFetcher.test.js b/src/components/DataFetcher/DataFetcher.test.js index a15158a38..df199ad92 100644 --- a/src/components/DataFetcher/DataFetcher.test.js +++ b/src/components/DataFetcher/DataFetcher.test.js @@ -53,6 +53,12 @@ const resources = buildResources({ fileName: 'testFileName', }], }], + otherResources: { + splitStatus: { + hasLoaded: true, + records: [{ splitStatus: true }] + } + } }); const TestComponent = () => {