Context
The data fetching in SamplesContextProvider is currently handled by a single useEffect that triggers when either the samplesQuery or myDataset state changes. Within this useEffect, the loading state is set to true before making the API call.
Problem or idea
We want to separate the data-fetching logic into multiple useEffect hooks:
- One
useEffect for setting loading to true when samplesQuery or myDataset change.
- Another
useEffect for making API call when loading changes to true.
Solution or next step
Implement the two usEffect described above in SamplesContextProvider.
Context
The data fetching in
SamplesContextProvideris currently handled by a singleuseEffectthat triggers when either thesamplesQueryormyDatasetstate changes. Within thisuseEffect, theloadingstate is set totruebefore making the API call.Problem or idea
We want to separate the data-fetching logic into multiple
useEffecthooks:useEffectfor settingloadingtotruewhensamplesQueryormyDatasetchange.useEffectfor making API call whenloadingchanges totrue.Solution or next step
Implement the two
usEffectdescribed above inSamplesContextProvider.