Offline: don't attempt to load reviews when offline

This commit is contained in:
Pieter Vander Vennet 2025-08-14 14:45:44 +02:00
parent 561e4cb009
commit 07a181aa1e

View file

@ -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