Fix perpetual "loading" titles when first opening the contributions list
CI / Lint (pull_request) Successful in 54s
CI / Test (pull_request) Successful in 1m8s
Release Drafter / Update release notes draft (pull_request) Successful in 5s

This commit is contained in:
2026-08-19 09:22:46 -06:00
parent 3d578177ab
commit 21d261ef17
2 changed files with 78 additions and 6 deletions
+40 -5
View File
@@ -6,8 +6,46 @@
* succession). Entries are ordered newest-first.
*/
import { tracked } from '@glimmer/tracking';
const HOUR_IN_SECONDS = 60 * 60;
/**
* A single contribution timeline entry.
*
* `placeName` and `placeNameLoading` are tracked so that mutating them after
* the entry has been rendered (e.g. when the background OSM batch fetch
* resolves a place name) re-renders the consuming component. The remaining
* fields are static data and do not need to be tracked.
*/
export class ContributionEntry {
type = 'photo';
placeIdentifier;
osmType;
osmId;
photos;
createdAt;
eventCount;
@tracked placeName = null;
@tracked placeNameLoading = true;
constructor({
placeIdentifier,
osmType,
osmId,
photos,
createdAt,
eventCount,
}) {
this.placeIdentifier = placeIdentifier;
this.osmType = osmType;
this.osmId = osmId;
this.photos = photos;
this.createdAt = createdAt;
this.eventCount = eventCount;
}
}
/**
* Parses a single kind 360 (Place Photo) event's `imeta` tag into a photo object.
* Reuses the same field shape as `parsePlacePhotos` in `utils/nostr.js` but operates
@@ -180,15 +218,12 @@ function buildEntry(placeIdentifier, events) {
const [, osmType, osmId] = placeIdentifier.split(':');
return {
type: 'photo',
return new ContributionEntry({
placeIdentifier,
osmType,
osmId,
placeName: null,
placeNameLoading: true,
photos,
createdAt,
eventCount: events.length,
};
});
}