From c50b23d5409c4a260d2f4327ef29ca612dba0f97 Mon Sep 17 00:00:00 2001 From: Sander Kranz Date: Sun, 28 Jan 2024 10:58:53 +0300 Subject: [PATCH] fix: prevent forwarding context to TopItemListContainer's DOM element (#1033) --- src/Virtuoso.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Virtuoso.tsx b/src/Virtuoso.tsx index da2b875b9..24268dcfb 100644 --- a/src/Virtuoso.tsx +++ b/src/Virtuoso.tsx @@ -363,11 +363,11 @@ const WindowViewport: React.FC> = ({ children } } const TopItemListContainer: React.FC> = ({ children }) => { - const TopItemList = useEmitterValue('TopItemListComponent') + const TopItemList = useEmitterValue('TopItemListComponent') || 'div' const headerHeight = useEmitterValue('headerHeight') const style = { ...topItemListStyle, marginTop: `${headerHeight}px` } const context = useEmitterValue('context') - return React.createElement(TopItemList || 'div', { style, context }, children) + return React.createElement(TopItemList, { style, ...contextPropIfNotDomElement(TopItemList, context) }, children) } const ListRoot: React.FC = /*#__PURE__*/ React.memo(function VirtuosoRoot(props) {