diff --git a/src/modules/events/composables/useMyEvents.ts b/src/modules/events/composables/useMyEvents.ts index 9def6d1..2012614 100644 --- a/src/modules/events/composables/useMyEvents.ts +++ b/src/modules/events/composables/useMyEvents.ts @@ -13,9 +13,10 @@ export function useMyEvents() { // and merge them into the feed. Otherwise an event that drops to // `proposed` after a non-admin edit disappears from the user's view // entirely — they'd be unable to find it to make a follow-up edit or - // monitor its approval status. Public approved events from other - // users take precedence on dedup (server is the source of truth for - // the public view). + // monitor its approval status. For the user's OWN events the + // authenticated record wins on dedup: it is the full `Event` (incl. + // `extra.promo_codes`, which public responses omit), and it is what + // the edit dialog must prefill from. const fetchAll = async (): Promise => { const publicEvents = (await ticketApi.fetchTicketedEvents()) as TicketedEvent[] @@ -26,9 +27,11 @@ export function useMyEvents() { try { const myEvents = (await ticketApi.fetchMyEvents(invoiceKey)) as TicketedEvent[] - const seen = new Set(publicEvents.map((e) => e.id)) - const own = myEvents.filter((e) => !seen.has(e.id)) - return [...publicEvents, ...own] + const own = new Map(myEvents.map((e) => [e.id, e])) + const merged = publicEvents.map((e) => own.get(e.id) ?? e) + const publicIds = new Set(publicEvents.map((e) => e.id)) + const ownOnly = myEvents.filter((e) => !publicIds.has(e.id)) + return [...merged, ...ownOnly] } catch (err) { // Falling back to just the public feed is acceptable — the user // can still browse, they just won't see their own pending events.