То же исключение пришло и для меня ... попробовал другой подход. Сцепил один метод извлечения в другом и попытался установить значение во все переменные источника данных в первом блоке извлечения, а затем использовал 2-ю переменную в следующий блок выборки снова.
Проблема решена, и значения теперь поступают по мере необходимости. Не знаю, если это идеальный подход, но это решило проблему, пожалуйста, попробуйте ссылаться на приведенный ниже пример
fetch(‘endpoint1’, {
method: 'post',
headers: {
'Accept': 'application/json',
'Content-type': 'application/json'
},
body: JSON.stringify({
//send the parameters you need to use to fetch the data
from endpoint
//e.g. “id”: this.state.id,
…
})
})
.then((response) => response.json())
.then((responseJson) => {
this.setState({
isLoading: false,
dataSource1: responseJson,
dataSource2: responseJson,
})
})
.then(()=>{
fetch(‘endpoint2', {
method: 'post',
headers: {
'Accept': 'application/json',
'Content-type': 'application/json'
},
body: JSON.stringify({
//send the parameters you need to use to fetch the data
from endpoint
//e.g. “id”: this.state.id,
…
})
})
.then((response) => response.json())
.then((responseJson) => {
this.setState({
isLoading: false,
dataSource2: responseJson,
})
})
})
.catch((error) => {
console.error(error);
});