Skip to content

Renaming a topic zeroes its prompt count on the Manage Topics page #594

Closed

Description

@gkhngyk

Problem

Renaming a topic on the Manage Topics page makes its prompt count drop to 0. updateTopic renames only the topics row, but getPromptCountByTopic counts prompts by the legacy prompts.category string — which still holds the old name after a rename. The Topics leaderboard, which counts by topic_id, keeps showing the correct number, so the two surfaces disagree.

Reproduction

  1. Create a topic with prompts assigned to it — Manage Topics shows the correct count.
  2. Rename the topic.
  3. The count next to it drops to 0; the Topics leaderboard still shows the real count.

Evidence

Suggested fix

Either count by topic_id in getPromptCountByTopic (preferred — change the parameter to the topic id and the filter to .eq('topic_id', topicId)), or have updateTopic also sync prompts.category for rows pointing at the renamed topic. The first is a smaller, safer change.

Acceptance criteria

  • After renaming a topic, its prompt count on Manage Topics is unchanged.
  • Manage Topics and the Topics leaderboard report the same count for the same topic.

Activity

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