fix: Use ref instead of stale closure for search state check

The load() function was using searchQuery from a stale closure,
causing it to skip fetches even after search was cleared.
Now uses searchResultsRef which is always current.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-01-26 00:57:35 +00:00
parent 3e780268ba
commit 33e7213ca9
1 changed files with 3 additions and 2 deletions

View File

@ -1077,8 +1077,9 @@ export function usePostsEngine({
} }
if (!resolvedView?.center) return; if (!resolvedView?.center) return;
} }
if ((searchQuery || "").trim()) { // Skip if search is active - check the ref, not the prop (which may be stale in closure)
console.log('[usePostsEngine] SKIP: searchQuery active:', searchQuery); if (searchResultsRef.current) {
console.log('[usePostsEngine] SKIP: search results active');
return; return;
} }