Skip to content

⚡ Bolt: Debounce search input to prevent UI freezing during text entry#113

Merged
Krosebrook merged 3 commits intomainfrom
bolt-optimize-search-filter-12344377677185105952
Mar 5, 2026
Merged

⚡ Bolt: Debounce search input to prevent UI freezing during text entry#113
Krosebrook merged 3 commits intomainfrom
bolt-optimize-search-filter-12344377677185105952

Conversation

@Krosebrook
Copy link
Owner

@Krosebrook Krosebrook commented Mar 5, 2026

💡 What: Implemented a custom useDebounce React hook and applied it to the searchQuery state in both the Dashboard and Explore pages. The useMemo dependency array for filteredSongs now relies on debouncedSearchQuery instead of the immediate searchQuery.

🎯 Why: Previously, typing in the search bar triggered a synchronous re-render and an expensive array .filter() operation on every keystroke. This filter checks both song.title and song.lyrics strings using .toLowerCase().includes(). For users with large libraries or when viewing the public Explore page, this caused main thread blocking and made the input feel laggy.

📊 Impact: Reduces expensive re-renders and array filtering operations during rapid typing by grouping them into a single execution after a 300ms pause. The input field remains strictly synchronous and instantly responsive.

🔬 Measurement: Type rapidly in the search bar on the Dashboard or Explore page. The input text will update instantly, and the song list below will filter smoothly once typing pauses, without any stuttering. Verified via isolated Playwright snapshot testing confirming the exact debounced behavior.


PR created automatically by Jules for task 12344377677185105952 started by @Krosebrook


Summary by cubic

Debounced song search on Dashboard and Explore to prevent freezes while typing. Filtering now runs after a 300ms pause, keeping input responsive on large lists.

  • New Features
    • Added useDebounce hook (300ms) and applied to filtering and active filter state on both pages; updated useMemo deps.
    • Added test_server.py to serve the SPA with an index.html fallback for local/dev static testing.

Written for commit 6a73689. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Debounced search added to Dashboard and Explore for smoother search behavior.
    • Lightweight static file server added to support local SPA testing.
  • Performance

    • Search input now debounces (default 300ms) to reduce redundant processing and improve responsiveness.

Added `useDebounce` hook to prevent expensive client-side array filtering
(`title` and `lyrics` string search via `.toLowerCase().includes()`) from running
on every keystroke. This significantly improves responsiveness when
typing in the search bar on pages with many song cards.

Co-authored-by: Krosebrook <214532761+Krosebrook@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings March 5, 2026 06:00
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the user experience by implementing a debouncing mechanism for search input fields. By delaying the execution of the expensive song filtering logic until after a brief pause in typing, it eliminates UI freezing and lag, making the search functionality feel much more responsive and smooth, especially for large datasets.

Highlights

  • New useDebounce Hook: A custom React hook, useDebounce, was introduced to debounce any value, with a default delay of 300ms, to control the frequency of updates.
  • Search Input Debouncing: The newly created useDebounce hook has been applied to the searchQuery state on both the Dashboard and Explore pages to prevent immediate re-renders on every keystroke.
  • Optimized Filtering Logic: The useMemo dependency arrays for filteredSongs in Dashboard and Explore were updated to rely on the debouncedSearchQuery instead of the immediate searchQuery, ensuring expensive filter operations only run after a pause in typing.
Changelog
  • client/src/hooks/use-debounce.ts
    • Added a new custom useDebounce React hook.
  • client/src/pages/Dashboard.tsx
    • Imported and applied the useDebounce hook to the search query.
    • Updated the useMemo dependency for filteredSongs to use the debounced search query.
  • client/src/pages/Explore.tsx
    • Imported and applied the useDebounce hook to the search query.
    • Updated the useMemo dependency for filteredSongs to use the debounced search query.
  • server_dev.log
    • Added a development server log file.
  • test_server.py
    • Added a Python script for serving static files.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b6d64c19-41bb-4e83-8afe-0f76ba4a1909

📥 Commits

Reviewing files that changed from the base of the PR and between 0d50fbb and 6a73689.

📒 Files selected for processing (2)
  • client/src/pages/Dashboard.tsx
  • client/src/pages/Explore.tsx

📝 Walkthrough

Walkthrough

Adds a generic React hook useDebounce (300ms default) and integrates it into Dashboard and Explore to debounce search input before filtering. Also adds a minimal SPA static test server (test_server.py) that serves dist/public with index.html fallback.

Changes

Cohort / File(s) Summary
Debounce Hook
client/src/hooks/use-debounce.ts
New generic useDebounce<T>(value, delay=300) hook returning a debounced value; sets/clears timer on updates and unmount.
Page Components
client/src/pages/Dashboard.tsx, client/src/pages/Explore.tsx
Import and use useDebounce(searchQuery, 300); replace searchQuery with debouncedSearchQuery in filtering logic, memo deps, and active-filter checks.
Test Server
test_server.py
New minimal SPA static server (PORT=5000, DIRECTORY="dist/public") that serves index.html for root and unknown routes.

Sequence Diagram

sequenceDiagram
    actor User
    participant SearchInput
    participant useDebounce
    participant FilterLogic
    participant Results

    User->>SearchInput: type characters
    SearchInput->>useDebounce: update(value)
    Note over useDebounce: reset timer on each update
    User->>SearchInput: continue typing
    SearchInput->>useDebounce: update(new value)
    Note over useDebounce: timer resets
    User->>SearchInput: stop typing
    Note over useDebounce: 300ms delay elapses
    useDebounce->>FilterLogic: emit debouncedSearchQuery
    FilterLogic->>Results: compute and render filtered results
    Results-->>User: display updated list
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through code in a quiet flurry,
Three hundred ticks to stop the hurry,
Keys settle down, the list grows clear,
Filters hum and results appear,
Index served up, the crowd can hear. 🎶

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: introducing debouncing to search input to prevent UI freezing. It directly relates to the primary objective of the PR.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bolt-optimize-search-filter-12344377677185105952

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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request successfully implements a useDebounce hook to improve the performance of search functionality on the Dashboard and Explore pages. By debouncing the search input, expensive filtering operations are now grouped, leading to a smoother user experience during rapid typing. The new useDebounce hook is well-structured and reusable. There are a couple of minor inconsistencies in the UI update logic and an unused import that could be addressed.

import http.server
import socketserver
import os
import time
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The time module is imported but not used in this file. Removing unused imports helps keep the codebase clean and reduces unnecessary dependencies.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 6 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="client/src/pages/Dashboard.tsx">

<violation number="1" location="client/src/pages/Dashboard.tsx:34">
P2: Debouncing search for filtering without aligning the active-filter state causes a brief UI inconsistency (filters appear cleared while stale filtered results are still shown).</violation>
</file>

<file name="server_dev.log">

<violation number="1" location="server_dev.log:2">
P3: Remove `server_dev.log` from the PR. Committing development runtime logs is a non-source artifact that creates noisy history and exposes local error output.</violation>
</file>

<file name="test_server.py">

<violation number="1" location="test_server.py:15">
P1: The fallback existence check uses `self.path` with query/fragment data, which can incorrectly route valid asset requests to `index.html`. Strip query/fragment before checking file existence.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.


def do_GET(self):
# Setup paths
path = self.path
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: The fallback existence check uses self.path with query/fragment data, which can incorrectly route valid asset requests to index.html. Strip query/fragment before checking file existence.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At test_server.py, line 15:

<comment>The fallback existence check uses `self.path` with query/fragment data, which can incorrectly route valid asset requests to `index.html`. Strip query/fragment before checking file existence.</comment>

<file context>
@@ -0,0 +1,28 @@
+
+    def do_GET(self):
+        # Setup paths
+        path = self.path
+        if path == '/':
+            path = '/index.html'
</file context>
Fix with Cubic

@@ -0,0 +1,15 @@

> rest-express@1.0.0 dev
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Remove server_dev.log from the PR. Committing development runtime logs is a non-source artifact that creates noisy history and exposes local error output.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At server_dev.log, line 2:

<comment>Remove `server_dev.log` from the PR. Committing development runtime logs is a non-source artifact that creates noisy history and exposes local error output.</comment>

<file context>
@@ -0,0 +1,15 @@
+
+> rest-express@1.0.0 dev
+> NODE_ENV=development tsx server/index.ts
+
</file context>
Fix with Cubic

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
test_server.py (2)

4-4: Remove unused import.

The time module is imported but never used in this file.

🧹 Proposed fix
 import http.server
 import socketserver
 import os
-import time
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test_server.py` at line 4, Remove the unused import "import time" from the
top of the file (the unused module symbol time) so there are no unnecessary
imports; verify no other references to time exist in functions or tests such as
any sleep/use of time before committing.

13-24: Consider path traversal mitigation for robustness.

While this is a test server, the path handling could allow directory traversal via .. sequences. The SimpleHTTPRequestHandler base class does have built-in protections, but the manual path construction at Line 19 bypasses some of those checks when determining fallback behavior.

For a test server this is acceptable, but if this ever moves toward broader use, consider normalizing and validating the path.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test_server.py` around lines 13 - 24, The do_GET method builds file_path from
self.path which can be manipulated with path traversal like '..'; normalize and
validate the requested path before using it: use os.path.normpath on
path.lstrip('/'), join with DIRECTORY to form file_path, then ensure
os.path.commonpath([DIRECTORY, file_path]) == os.path.abspath(DIRECTORY) (or
check that normalized path does not start with '..') and if the check fails or
the file doesn't exist, set self.path = '/index.html' as the safe fallback;
update references to path, file_path, and DIRECTORY in do_GET accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test_server.py`:
- Line 4: Remove the unused import "import time" from the top of the file (the
unused module symbol time) so there are no unnecessary imports; verify no other
references to time exist in functions or tests such as any sleep/use of time
before committing.
- Around line 13-24: The do_GET method builds file_path from self.path which can
be manipulated with path traversal like '..'; normalize and validate the
requested path before using it: use os.path.normpath on path.lstrip('/'), join
with DIRECTORY to form file_path, then ensure os.path.commonpath([DIRECTORY,
file_path]) == os.path.abspath(DIRECTORY) (or check that normalized path does
not start with '..') and if the check fails or the file doesn't exist, set
self.path = '/index.html' as the safe fallback; update references to path,
file_path, and DIRECTORY in do_GET accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b351a1e1-cc3f-4809-99b1-ccd2e716d927

📥 Commits

Reviewing files that changed from the base of the PR and between 4652bcf and 0d50fbb.

⛔ Files ignored due to path filters (2)
  • server.log is excluded by !**/*.log
  • server_dev.log is excluded by !**/*.log
📒 Files selected for processing (4)
  • client/src/hooks/use-debounce.ts
  • client/src/pages/Dashboard.tsx
  • client/src/pages/Explore.tsx
  • test_server.py

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a reusable debouncing hook to the client and applies it to the Dashboard/Explore search flow so expensive in-memory filtering doesn’t run on every keystroke.

Changes:

  • Added useDebounce hook (client/src/hooks/use-debounce.ts).
  • Updated Dashboard and Explore to filter songs based on debouncedSearchQuery instead of the immediate searchQuery.
  • Added local/dev artifacts (Python test server + log files) to the repository.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
client/src/hooks/use-debounce.ts New generic useDebounce hook with a default 300ms delay.
client/src/pages/Dashboard.tsx Uses debounced search value for song filtering and memo dependencies.
client/src/pages/Explore.tsx Uses debounced search value for public song filtering and memo dependencies.
test_server.py Adds a standalone Python SPA server script.
server_dev.log Adds a captured dev runtime error log.
server.log Adds a large access/error log dump from local execution.
Comments suppressed due to low confidence (1)

test_server.py:4

  • time is imported but never used. Please remove the unused import to avoid lint/typecheck noise.
import http.server
import socketserver
import os
import time

Comment on lines +135 to +137
const matchesSearch = debouncedSearchQuery === "" ||
song.title.toLowerCase().includes(debouncedSearchQuery.toLowerCase()) ||
song.lyrics.toLowerCase().includes(debouncedSearchQuery.toLowerCase());
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debouncedSearchQuery.toLowerCase() is computed multiple times per song during filtering. For large lists, it’s cheaper to compute a single lower-cased query once per useMemo run and reuse it inside the filter predicate.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +8
import http.server
import socketserver
import os
import time

PORT = 5000
DIRECTORY = "dist/public"

Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR’s stated goal is debouncing search in the React UI, but it also adds a standalone Python HTTP server script at the repo root. If this is only for local experimentation, it should be removed from the PR (or moved under an appropriate scripts/devtools location and documented), otherwise it’s unrelated surface area to maintain.

Copilot uses AI. Check for mistakes.
}, [songs, searchQuery, genreFilter, moodFilter]);
}, [songs, debouncedSearchQuery, genreFilter, moodFilter]);

const hasActiveFilters = searchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasActiveFilters is derived from the immediate searchQuery, but the actual filtering is driven by debouncedSearchQuery. This can cause UI/state mismatches (e.g., the clear-filters button and "Showing X of Y" can disappear immediately after clearing the input while the list is still filtered for up to 300ms). Consider basing this flag on the same "effective" query used for filtering (or include both searchQuery and debouncedSearchQuery so the UI stays consistent during the debounce window).

Suggested change
const hasActiveFilters = searchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";
const hasActiveFilters =
debouncedSearchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +36
const matchesSearch = debouncedSearchQuery === "" ||
song.title.toLowerCase().includes(debouncedSearchQuery.toLowerCase()) ||
song.lyrics.toLowerCase().includes(debouncedSearchQuery.toLowerCase());
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inside the songs.filter callback, debouncedSearchQuery.toLowerCase() is recomputed multiple times per song. Since this code is specifically targeting performance during large-list filtering, compute the lower-cased query once per memo execution and reuse it in the predicate to reduce redundant work.

Copilot uses AI. Check for mistakes.
}, [songs, searchQuery, genreFilter, moodFilter, sortBy]);
}, [songs, debouncedSearchQuery, genreFilter, moodFilter, sortBy]);

const hasActiveFilters = searchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasActiveFilters is derived from the immediate searchQuery, but filtering is based on debouncedSearchQuery. This can briefly desync the UI from the results (e.g., clearing the input can hide the clear-filters control while the list is still filtered for the debounce delay). Consider basing this flag on the same "effective" query used for filtering (or include both values) so the UI remains consistent during the debounce window.

Suggested change
const hasActiveFilters = searchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";
const hasActiveFilters = debouncedSearchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d50fbbb29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +26 to +28
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print(f"Serving SPA at port {PORT}")
httpd.serve_forever()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Guard test server startup behind main

test_server.py starts httpd.serve_forever() at import time, so importing this module never returns (for example, python -c "import test_server" hangs), and any automation that imports discovered test modules can stall during collection. Wrapping the server startup in an if __name__ == "__main__": guard avoids blocking unrelated tooling.

Useful? React with 👍 / 👎.

Krosebrook and others added 2 commits March 5, 2026 07:39
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@Krosebrook
Copy link
Owner Author

@copilot open a new pull request to apply changes based on the comments in this thread

@Krosebrook Krosebrook merged commit b2f79f4 into main Mar 5, 2026
2 of 3 checks passed
@Krosebrook Krosebrook deleted the bolt-optimize-search-filter-12344377677185105952 branch March 5, 2026 13:40
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="client/src/pages/Explore.tsx">

<violation number="1" location="client/src/pages/Explore.tsx:156">
P2: Use the immediate `searchQuery` for `hasActiveFilters`; debouncing this flag makes clear/filter UI state lag behind user input.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

}, [songs, debouncedSearchQuery, genreFilter, moodFilter, sortBy]);

const hasActiveFilters = searchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";
const hasActiveFilters = debouncedSearchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Use the immediate searchQuery for hasActiveFilters; debouncing this flag makes clear/filter UI state lag behind user input.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/src/pages/Explore.tsx, line 156:

<comment>Use the immediate `searchQuery` for `hasActiveFilters`; debouncing this flag makes clear/filter UI state lag behind user input.</comment>

<file context>
@@ -153,7 +153,7 @@ export default function Explore() {
   }, [songs, debouncedSearchQuery, genreFilter, moodFilter, sortBy]);
 
-  const hasActiveFilters = searchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";
+const hasActiveFilters = debouncedSearchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";
 
   const clearFilters = () => {
</file context>
Suggested change
const hasActiveFilters = debouncedSearchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";
const hasActiveFilters = searchQuery !== "" || genreFilter !== "all" || moodFilter !== "all";
Fix with Cubic

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.

2 participants