Skip to content

fix: prevent Practice clear-all crash#162

Open
Rajesh270712 wants to merge 1 commit into
kunalverma2512:mainfrom
Rajesh270712:reputation/REP-PR-006-codelens-clear-all
Open

fix: prevent Practice clear-all crash#162
Rajesh270712 wants to merge 1 commit into
kunalverma2512:mainfrom
Rajesh270712:reputation/REP-PR-006-codelens-clear-all

Conversation

@Rajesh270712

@Rajesh270712 Rajesh270712 commented Jun 4, 2026

Copy link
Copy Markdown

Summary

  • Removes the invalid setDebouncedSearch("") call from clearAll on the Practice page.
  • Keeps the existing filter reset behavior for search, tags, rating, sort, and page.

Linked issue

Problem

Clicking Clear All can call setDebouncedSearch, but that setter is not defined in PracticePage.jsx, causing a ReferenceError.

Fix

clearAll now resets the source searchQuery state only. The existing debounced search effect then updates debouncedSearch through the normal path.

Validation

  • npm ci
  • npx eslint src/pages/PracticePage.jsx
  • npm run build
  • Browser click-through: Clear All and Clear All Filters no longer produce console errors.

Risk notes

  • Scope is one line in frontend/src/pages/PracticePage.jsx.
  • Full repo lint has unrelated existing failures outside this file; targeted lint for PracticePage.jsx passes.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue on the Practice page where the search input field was not being properly cleared when users clicked to reset all filters.

@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

@Rajesh270712 is attempting to deploy a commit to the Kunal Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

🚀 PR Received Successfully

Hello @Rajesh270712,

Thank you for taking the initiative to contribute to this project.

Please ensure that your PR follows all project guidelines properly before requesting review.

⚠️ Important Instructions

  • Maintain proper code quality and structure
  • Do not make unnecessary changes/files
  • Ensure responsiveness across devices
  • Follow existing project conventions strictly
  • Attach screenshots/videos for UI-related changes
  • Resolve merge conflicts before requesting review
  • Avoid AI-generated low quality PRs or copied implementations

📌 Mandatory for GSSoC'26 Participants

Joining the community group and announcement channel is compulsory for all contributors participating through GSSoC'26.

Failure to follow contribution guidelines may lead to PR rejection.

We appreciate your effort and wish you a great open-source journey ahead. ✨

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 975f2dce-a6f5-4363-afbd-608388c075bc

📥 Commits

Reviewing files that changed from the base of the PR and between bb710dd and 0a14f69.

📒 Files selected for processing (1)
  • frontend/src/pages/PracticePage.jsx
💤 Files with no reviewable changes (1)
  • frontend/src/pages/PracticePage.jsx

📝 Walkthrough

Walkthrough

The clearAll handler in PracticePage.jsx is fixed to remove an invalid call to setDebouncedSearch, which does not exist as a setter. The function now only resets the source searchQuery state, allowing the useDebounce hook to naturally propagate the cleared value.

Changes

Clear All Filter Reset Bug Fix

Layer / File(s) Summary
clearAll handler bug fix
frontend/src/pages/PracticePage.jsx
The clearAll function removes the invalid setDebouncedSearch("") call that caused a ReferenceError. It now only calls setSearchQuery("") to reset search, while continuing to reset selected tags, rating, sort mode, and pagination.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A ghost setter haunted the clear,
setDebouncedSearch, not here!
One line removed, the bug takes flight,
Debounce hooks handle it right.
✨ Clear all, no more fright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the bug fix: preventing a crash in the Practice page's clear-all functionality.
Description check ✅ Passed The PR description covers the problem, fix, validation steps, and risk assessment comprehensively, though it deviates from the template structure.
Linked Issues check ✅ Passed The PR directly addresses issue #161 by removing the invalid setDebouncedSearch("") call, fully satisfying all coding requirements and acceptance criteria.
Out of Scope Changes check ✅ Passed The change is tightly scoped to one line in PracticePage.jsx, removing only the problematic setDebouncedSearch("") call without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kunalverma2512 kunalverma2512 requested review from kunalverma2512 and removed request for kunalverma2512 June 7, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: ReferenceError: setDebouncedSearch is not defined when clicking 'Clear All' on Practice Page

1 participant