forked from MapComplete/MapComplete
Offline: don't attempt to load reviews when offline
This commit is contained in:
parent
561e4cb009
commit
07a181aa1e
1 changed files with 5 additions and 1 deletions
|
@ -5,6 +5,7 @@ import { Feature, Position } from "geojson"
|
||||||
import { GeoOperations } from "../GeoOperations"
|
import { GeoOperations } from "../GeoOperations"
|
||||||
import { SpecialVisualizationState } from "../../UI/SpecialVisualization"
|
import { SpecialVisualizationState } from "../../UI/SpecialVisualization"
|
||||||
import { WithUserRelatedState } from "../../Models/ThemeViewState/WithUserRelatedState"
|
import { WithUserRelatedState } from "../../Models/ThemeViewState/WithUserRelatedState"
|
||||||
|
import { IsOnline } from "./IsOnline"
|
||||||
|
|
||||||
export interface ReviewCollection {
|
export interface ReviewCollection {
|
||||||
readonly subjectUri?: Store<string>
|
readonly subjectUri?: Store<string>
|
||||||
|
@ -238,11 +239,14 @@ export default class FeatureReviews implements ReviewCollection {
|
||||||
if (!loadingAllowed.data) {
|
if (!loadingAllowed.data) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!IsOnline.isOnline.data) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const reviews = await MangroveReviews.getReviews({ sub })
|
const reviews = await MangroveReviews.getReviews({ sub })
|
||||||
console.debug("Got reviews for", feature, reviews, sub)
|
console.debug("Got reviews for", feature, reviews, sub)
|
||||||
this.addReviews(reviews.reviews, this._name.data)
|
this.addReviews(reviews.reviews, this._name.data)
|
||||||
},
|
},
|
||||||
[this._name, loadingAllowed]
|
[this._name, loadingAllowed, IsOnline.isOnline]
|
||||||
)
|
)
|
||||||
/* We also construct all subject queries _without_ encoding the name to work around a previous bug
|
/* We also construct all subject queries _without_ encoding the name to work around a previous bug
|
||||||
* See https://github.com/giggls/opencampsitemap/issues/30
|
* See https://github.com/giggls/opencampsitemap/issues/30
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue