Skip to content

Fix useMemo deps growing between renders in SearchConditions (#94) - #95

Merged
reekitconcept merged 1 commit into
feature-ai-ragfrom
kid/fix-searchconditions-deps
Jul 29, 2026
Merged

Fix useMemo deps growing between renders in SearchConditions (#94)#95
reekitconcept merged 1 commit into
feature-ai-ragfrom
kid/fix-searchconditions-deps

Conversation

@reekitconcept

Copy link
Copy Markdown
Member

Fixes the React dev warning The final argument passed to useMemo changed size between renders on the search page (#94).

The deps array spread Object.values(vocabData), which grows from 0 to N entries as facet vocabularies load. vocabData comes from useSelector(..., shallowEqual) in useVocabs, so its identity already changes exactly when some vocabulary's items change — it serves as a single constant-size dependency with identical recompute triggers (no missed updates, no per-render recomputes; react-redux reuses the previous reference when the equality function passes, in both v7 and v8 semantics).

Verified in the browser: warning gone on search page loads with facet vocabularies; all 17 SearchConditions unit tests pass.

Same fix goes to main in a separate PR (the bug exists on the release line too).

React warned 'The final argument passed to useMemo changed size between
renders': the deps array spread Object.values(vocabData), which grows
from 0 to N entries as vocabularies load. vocabData comes from
useSelector(..., shallowEqual) in useVocabs, so its identity already
changes exactly when some vocabulary's items change - use the object
itself as a constant-size dependency.
@reekitconcept
reekitconcept merged commit 6b2d43e into feature-ai-rag Jul 29, 2026
17 checks passed
@reekitconcept
reekitconcept deleted the kid/fix-searchconditions-deps branch July 29, 2026 13:56
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