Skip to content

DashboardQuery eager-loads workshop_host with :sponsors in one join (same host-loss trap as #2975) #2982

Description

@mroderick

DashboardQuery.upcoming_events eager-loads :workshop_host together with :sponsors in one join (app/queries/dashboard_query.rb:5-6). Both associations route through the workshop_sponsors table, so the scoped has_one falls into the same eager-load alias trap documented in #2975: workshop_host comes back nil or points at a non-host sponsor, on a plan-dependent subset of workshops.

Suggested fix: the same pattern the events listing now uses (#2981, Listable.most_recent) — keep :sponsors in the join, move the host to preload:

Workshop.eager_load(:chapter, :sponsors, :organisers, :permissions)
        .preload(workshop_host: :sponsor)

Worth confirming first whether the dashboard card actually renders the wrong venue when workshop_host is lost (follow the same repro sketch as #2975), or only shows no venue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions