Process yourLocations even without response
This commit is contained in:
parent
8025d9c3d5
commit
add46379bd
1 changed files with 13 additions and 10 deletions
|
|
@ -142,16 +142,19 @@ void fetchDataMiddleware(Store<AppState> store, action, NextDispatcher next) {
|
||||||
// Our reducer will then update the State using these YourLocations.
|
// Our reducer will then update the State using these YourLocations.
|
||||||
// print('Subscribed to: ${subscribedLocations.length}');
|
// print('Subscribed to: ${subscribedLocations.length}');
|
||||||
loadYourLocations().then((localLocations) {
|
loadYourLocations().then((localLocations) {
|
||||||
|
if (subscribedLocations is List) {
|
||||||
// unsubscribe all locally to sync the subs state
|
// unsubscribe all locally to sync the subs state
|
||||||
localLocations.forEach((location) => location.subscribed = false);
|
localLocations.forEach((location) => location.subscribed = false);
|
||||||
// print('Local persisted: ${localLocations.length}');
|
// print('Local persisted: ${localLocations.length}');
|
||||||
subscribedLocations.forEach((subsLoc) {
|
subscribedLocations.forEach((subsLoc) {
|
||||||
localLocations.firstWhere(
|
localLocations
|
||||||
|
.firstWhere(
|
||||||
(localLocation) => localLocation.id == subsLoc.id, orElse: () {
|
(localLocation) => localLocation.id == subsLoc.id, orElse: () {
|
||||||
localLocations.add(subsLoc);
|
localLocations.add(subsLoc);
|
||||||
}).subscribed = true;
|
})
|
||||||
|
.subscribed = true;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
localLocations.forEach((yl) {
|
localLocations.forEach((yl) {
|
||||||
api.getYourLocationFireStats(store.state, yl).then((value) {
|
api.getYourLocationFireStats(store.state, yl).then((value) {
|
||||||
yl.currentNumFires = value.numFires;
|
yl.currentNumFires = value.numFires;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue