Skip to content

fix: add client-side validation to prevent goal target of 0 or less (#929)#1616

Open
mallya-m wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
mallya-m:fix/goal-nan-target-929
Open

fix: add client-side validation to prevent goal target of 0 or less (#929)#1616
mallya-m wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
mallya-m:fix/goal-nan-target-929

Conversation

@mallya-m

Copy link
Copy Markdown
Contributor

Summary

Closes #929

The progress bar NaN issue when target=0 was already guarded in the calculation, but users could still submit a goal with target=0. This PR adds explicit client-side validation that catches target ≤ 0 before the API call and shows a clear error message.

Type of Change

  • Bug fix

Changes Made

  • Added client-side validation in handleCreate — returns early with error message if target <= 0
  • Complements the existing min={1} attribute and division guard already in the codebase

How to Test

  1. Go to Goals section
  2. Try creating a goal with target = 0
  3. See error: "Target must be greater than 0."

Checklist

  • Linked issue in summary
  • No TypeScript errors
  • Self-reviewed the diff

@vercel

vercel Bot commented May 30, 2026

Copy link
Copy Markdown

@mallya-m is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature labels May 30, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@mallya-m

Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder PR ready! Added explicit client-side validation in handleCreate that catches target ≤ 0 before the API call and shows a clear error message.
Could you add gssoc labels ?
Ready for merge!

@mallya-m

Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder all CI checks pass (Build, Lint, Type check, Dependency audit).

The E2E failures are pre-existing infrastructure issues unrelated to this PR:

  • sharp package missing in standalone mode
  • Supabase unavailable in CI environment
  • Dashboard heading timeout (session/auth issue in test env)

My change only adds client-side validation in handleCreate to prevent target ≤ 0. Ready for merge!

@Priyanshu-byte-coder Priyanshu-byte-coder added gssoc:approved GSSoC: PR approved for scoring level2 GSSoC Level 2 - Medium complexity (25 points) labels May 31, 2026
@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

This PR now has merge conflicts with main. Please rebase your branch against the latest main and force-push to resolve. Run: git fetch upstream && git rebase upstream/main

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

This PR has merge conflicts with the current main branch. Please rebase your branch onto main, resolve the conflicts, and force-push. Once conflicts are resolved and the PR is marked as mergeable it will be reviewed for merging.

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

This PR has developed merge conflicts after recent merges to main. Please rebase onto the latest main branch, resolve all conflicts, and force-push. Once the PR is conflict-free it will be reviewed for merging.

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

This PR has merge conflicts with main. Please rebase:

git fetch origin
git rebase origin/main
# fix conflicts, then:
git push --force-with-lease

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

This PR has merge conflicts. Please rebase on the latest main to resolve them — the feature/fix is approved for GSSoC scoring.

@Priyanshu-byte-coder Priyanshu-byte-coder added the level:beginner GSSoC: Beginner difficulty (20 pts) label Jun 3, 2026
@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

This PR has merge conflicts with main. Please rebase to unblock it:

git fetch origin
git rebase origin/main
# resolve conflicts, then:
git push --force-with-lease

@Priyanshu-byte-coder Priyanshu-byte-coder added the quality:clean GSSoC: Clean quality multiplier (×1.2) label Jun 3, 2026
@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

This PR has merge conflicts with main. Please rebase:

git fetch origin
git rebase origin/main
git push --force-with-lease

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

This PR has merge conflicts with main — please rebase:

git fetch origin
git rebase origin/main
# Resolve any conflicts, then:
git push --force-with-lease

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

This PR has merge conflicts with main due to recent changes. Please rebase to continue:

git fetch origin
git rebase origin/main

Once you resolve the conflicts and CI passes, we can review for merge.

@mallya-m mallya-m force-pushed the fix/goal-nan-target-929 branch from f6359c4 to a0be032 Compare June 9, 2026 01:54
@mallya-m

mallya-m commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder rebased onto latest upstream/main — all conflicts resolved. Build , Lint , Type check.
Ready to merge!

@mallya-m

mallya-m commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder re-applied the target validation fix after rebase — all conflicts resolved and fix is in place. Ready to merge!

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

Labels

gssoc:approved GSSoC: PR approved for scoring gssoc26 GSSoC 2026 contribution level:beginner GSSoC: Beginner difficulty (20 pts) level2 GSSoC Level 2 - Medium complexity (25 points) quality:clean GSSoC: Clean quality multiplier (×1.2) type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Goal progress bar shows NaN when target is set to 0

2 participants