Skip to content

fix(citations): Competitor Gaps 'By competitor' selector shows the competitor id instead of its name #328

Closed

Description

@gkhngyk

Problem

On the Citations page (/dashboard/citations) → Competitor Gaps tab → By competitor view, the competitor selector shows the competitor names in the dropdown options (correct), but once you pick one, the trigger shows the competitor's id (a UUID) instead of its name.

Root cause

The selector's SelectValue has no render function, so Base-UI renders the raw selected value — and the value is the competitor id.

In web/src/app/[locale]/(dashboard)/dashboard/citations/page.tsx, ByCompetitorView builds the select as:

<Select value={competitorId} onValueChange={(v) => { if (v) onSelect(v); }}>
  <SelectTrigger className="h-8 w-56 text-xs">
    <SelectValue placeholder="Select competitor" />   {/* ← no label mapping */}
  </SelectTrigger>
  <SelectContent>
    {gaps.competitors.map((c) => (
      <SelectItem key={c.id} value={c.id}>{c.name}</SelectItem>
    ))}
  </SelectContent>
</Select>

SelectItem value={c.id} sets the value to the id; with this Base-UI Select, the trigger shows the raw value unless SelectValue is given a render function that maps value → label.

The other selects on the same page already do this — see the Platform and Topic selects, e.g.:

<SelectValue placeholder="All Platforms">
  {(value) => (value && value !== '__all__'
    ? (platforms.find((p) => p.value === value)?.label ?? getGroupedPlatformLabel(value))
    : 'All Platforms')}
</SelectValue>

Fix

Give the competitor SelectValue a render function that maps the selected id to the competitor name:

<SelectValue placeholder="Select competitor">
  {(value) => gaps.competitors.find((c) => c.id === value)?.name ?? 'Select competitor'}
</SelectValue>

Acceptance

  • On Competitor Gaps → By competitor, selecting a competitor shows its name in the trigger (not the id).
  • The dropdown options and the by-competitor table are unchanged.
  • yarn lint / typecheck / format:check from web/ pass.

Activity

  1. added
    bug
    good first issue
    on Jul 1, 2026
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

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions