Skip to content

Entries being duplicated in the databaseΒ #4

@vector1505

Description

@vector1505

πŸ› Bug Report: Duplicate entries being created in the database

Description

Whenever a player submits their name after completing the game, the leaderboard/database shows each entry twice. This inflates the leaderboard and makes it unclear which entry is correct.

Problem

  • Submitting a score causes two identical entries to be stored.
  • The leaderboard becomes cluttered and misleading.
  • Database integrity is being compromised.

Expected Behavior

  • Each player submission should only create one record in the database.
  • Leaderboard should reflect accurate and unique entries.

Steps to Reproduce

  1. Complete a Sudoku game.
  2. Enter a name when prompted to submit the score.
  3. Check the database or leaderboard.
  4. Observe that the same entry is listed twice.

Possible Causes

  • The form submission handler might be firing twice (e.g., due to onSubmit and onClick both triggering).
  • API request could be called multiple times unintentionally.
  • Backend route may be processing the same request more than once.

Possible Fix

  • Review the submit handler logic on the client side to ensure it only fires once.
  • Add safeguards in the backend to prevent duplicate insertions (e.g., unique constraints, deduplication checks).
  • Verify that the API endpoint returns a response before allowing another submission.

Additional Context

  • Check whether this bug only occurs on certain browsers/environments.
  • Adding logs to both client and server during submission may help trace the duplication.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions