Skip to content

Conversation

@Riddhish1
Copy link

Problem

Searching in the documentation search modal (for example, “sitemap” on /start/latest) caused the page to freeze due to an infinite render loop. This behavior is tracked in #601.

Root Cause

The LibraryRefinement and FrameworkRefinement components included items and refine in their useEffect dependency arrays, which caused a feedback loop:

Search query updates → items changes

useEffect runs → calls refine()

refine() triggers a re-render → items changes again

Loop repeats indefinitely, freezing the page

Solution

Removed items and refine from the useEffect dependency arrays

Updated effects to trigger only on route changes (subpathname)

Added an items.length > 0 guard to ensure refinement runs only when data is available

Added an ESLint disable comment for react-hooks/exhaustive-deps where appropriate

Testing

✅ Search works without freezing

✅ Library and framework filters still auto-apply based on the current route

✅ No infinite loops or performance issues

✅ Search results render correctly

Files Changed

SearchModal.tsx

gif_search

@netlify
Copy link

netlify bot commented Dec 24, 2025

👷 Deploy request for tanstack pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit c0963f9

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.

1 participant