-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
π 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
- Complete a Sudoku game.
- Enter a name when prompted to submit the score.
- Check the database or leaderboard.
- Observe that the same entry is listed twice.
Possible Causes
- The form submission handler might be firing twice (e.g., due to
onSubmitandonClickboth 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.
Reactions are currently unavailable