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:
parent
3e780268ba
commit
33e7213ca9
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue