Skip to content

Increment rsvpCount or remove the Going counter and Popularity sort #49

Description

@ameyypawar

rsvpCount is written exactly once, as the literal 0, when an event is created. No code path anywhere in the repository ever increments, decrements, or otherwise writes it again. Four surfaces read it and display it as attendance, and one user-selectable sort orders events by it.

Location

  • src/lib/services/eventService.ts:31 — the only write
  • src/components/events/EventCard.tsx:60 — "X Going" in the feed
  • src/app/events/[id]/page.tsx:35, :158 — "X Going" on the detail page
  • src/app/page.tsx:162 — the landing page event list
  • src/app/search/page.tsx:226 — "X attendees" in search results
  • src/components/events/EventFeed.tsx:79-81 and :123 — the "Popularity" sort option
    const docRef = await addDoc(collection(db, 'events'), {
      ...eventData,
      author,
      dateTime: dateTime.toISOString(),
      createdAt: serverTimestamp(),
      rsvpCount: 0,
    });

Full grep for rsvpCount across src/: the write above; static values in src/lib/mockData.ts; the Omit<...> at eventService.ts:16; the type declaration at src/lib/types.ts:27; and read-only sites in the five display surfaces plus searchService.ts:162,187. There is no increment, updateDoc, or setDoc call anywhere in src/ touching the events collection, and no functions/ directory, so there is no server-side path either.

Current behaviour

Every event created through the app permanently displays "0 Going" and "0 attendees". Selecting the "Popularity" sort in the events feed compares zeroes, so the order is effectively unchanged — the option appears to work and does nothing.

Expected behaviour

Either the count reflects real RSVPs, or the counter and the Popularity sort are removed so the UI does not present a field with no data behind it.

Why this matters

The counter reads as social proof on the events feed, the landing page, the detail page, and search results. Every event showing "0 Going" makes a live event look unattended. The "Popularity" sort is a control the user selects and gets no result from, with no indication why.

Suggested fix

This depends on the RSVP decision in the companion event-detail-page issue.

If RSVP stays external (rsvpLink): the app cannot know attendance, so remove the counter from all four display sites and remove the 'popularity' branch at EventFeed.tsx:79-81 together with its SelectItem at :123. Drop rsvpCount from the write in eventService.ts as well, so no field implies data that does not exist.

If a native RSVP is built: add an events/{id}/rsvps/{uid} subcollection, and in the RSVP write use increment(1) / increment(-1) on the parent document's rsvpCount inside a batch or transaction with the subcollection write, so the counter cannot drift from the membership. Keep the existing rsvpCount || 0 fallbacks for documents predating the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions