Keep a picked place image and its credit visible everywhere

Accommodation cards read the place from page-local state, so a new thumbnail
only showed up there after a reload. place:updated now asks the planner to
reload them, but only when the image actually changed - renaming a place must
not trigger a refetch.

The inspector shows the stored credit under the avatar. Crediting a CC BY-SA
picture only in the moment it is chosen is not enough; the obligation travels
with the picture.

Also lets a GIF hero through to the PDF. Uploads accept gif, the PDF extension
check did not, so one silently fell back to the category icon.
This commit is contained in:
Maurice
2026-08-09 22:32:00 +02:00
committed by Maurice
parent 4843ebc937
commit 5d99886b04
4 changed files with 95 additions and 1 deletions
@@ -477,9 +477,25 @@ export function handleRemoteEvent(set: SetState, get: GetState, event: WebSocket
// Snapshot before set(): the trip:updated case below replaces state.trip, so a
// date-change check made after it would compare the new trip against itself.
const prevTrip = get().trip
// Same reason, for the image check below — the applier overwrites the row.
const prevPlaceImage =
type === 'place:updated'
? get().places.find(p => p.id === (payload.place as Place | undefined)?.id)?.image_url
: undefined
set(state => STATE_APPLIERS[type as TrekWsTripEventName]?.(payload, state) ?? {})
// Accommodation cards read their thumbnail from a page-local copy of the
// place, not from this store, so a new hero image would only appear there
// after a reload. Narrow to an actual image change: every other place edit
// (renaming, recategorising) must not trigger a refetch.
if (type === 'place:updated') {
const nextImage = (payload.place as Place | undefined)?.image_url
if (nextImage !== prevPlaceImage) {
window.dispatchEvent(new CustomEvent('accommodations:refresh'))
}
}
// A reorder/insert re-pins dates and re-stamps booking times server-side, so
// pull the authoritative days + reservations for collaborators.
if (type === 'day:reordered') {