mirror of
https://github.com/strapi/strapi.git
synced 2025-11-13 16:52:18 +00:00
fix(content-manager): add optional chaining because listRef may not have a node attached (#18093)
This commit is contained in:
parent
36b8dc9438
commit
a472dbc410
@ -196,13 +196,13 @@ const RelationInput = ({
|
|||||||
updatedRelationsWith.current === 'onChange' &&
|
updatedRelationsWith.current === 'onChange' &&
|
||||||
relations.length !== previewRelationsLength
|
relations.length !== previewRelationsLength
|
||||||
) {
|
) {
|
||||||
listRef.current.scrollToItem(relations.length, 'end');
|
listRef.current?.scrollToItem(relations.length, 'end');
|
||||||
updatedRelationsWith.current = undefined;
|
updatedRelationsWith.current = undefined;
|
||||||
} else if (
|
} else if (
|
||||||
updatedRelationsWith.current === 'loadMore' &&
|
updatedRelationsWith.current === 'loadMore' &&
|
||||||
relations.length !== previewRelationsLength
|
relations.length !== previewRelationsLength
|
||||||
) {
|
) {
|
||||||
listRef.current.scrollToItem(0, 'start');
|
listRef.current?.scrollToItem(0, 'start');
|
||||||
updatedRelationsWith.current = undefined;
|
updatedRelationsWith.current = undefined;
|
||||||
}
|
}
|
||||||
}, [previewRelationsLength, relations]);
|
}, [previewRelationsLength, relations]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user