Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/packages/volto-solr/news/94.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix React warning in SearchConditions: the useMemo dependency array grew as vocabularies loaded (spread of vocabData values); use the vocabData object itself as a constant-size dependency. @reebalazs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,12 @@ export const SearchConditions = ({
})}
</div>
) : null,
// Use spread operator to perform a shallow equality check on the vocabData object
// vocabData comes from useSelector(..., shallowEqual) in useVocabs,
// so its identity only changes when some vocabulary's items change:
// it works as a single dependency. (Spreading its values here made
// the deps array grow as vocabularies loaded, which React warns
// about: the deps array size must stay constant between renders.)
// eslint-disable-next-line react-hooks/exhaustive-deps
[JSON.stringify(facetFields), conditionTree, ...Object.values(vocabData)],
[JSON.stringify(facetFields), conditionTree, vocabData],
);
};
Loading