From 0bcef9bcb6b45c7039f94ff13452928c910e5597 Mon Sep 17 00:00:00 2001 From: Cee Chen Date: Thu, 4 Jan 2024 14:08:29 -0800 Subject: [PATCH] Typescript lint workaround - my local vscode doesn't complain about this, but CLI does - not totally sure why or if this makes sense :| --- src/components/datagrid/body/cell/focus_utils.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/datagrid/body/cell/focus_utils.tsx b/src/components/datagrid/body/cell/focus_utils.tsx index 6d80a472955..77b655eb6cb 100644 --- a/src/components/datagrid/body/cell/focus_utils.tsx +++ b/src/components/datagrid/body/cell/focus_utils.tsx @@ -11,6 +11,7 @@ import React, { FunctionComponent, useEffect, useState, + useMemo, } from 'react'; import { tabbable } from 'tabbable'; @@ -58,9 +59,10 @@ export const HandleInteractiveChildren: FunctionComponent< } }, [cellEl, updateCellFocusContext]); - if (!cellEl) return children; // Do nothing if cell has yet to mount or is unmounting - if (!renderFocusTrap) return children; // Cells with default actions / expansion popovers do not need to trap - if (!hasInteractiveChildren) return children; // No need to focus trap if no children are interactive + const _children = useMemo(() => <>{children}, [children]); + if (!cellEl) return _children; // Do nothing if cell has yet to mount or is unmounting + if (!renderFocusTrap) return _children; // Cells with default actions / expansion popovers do not need to trap + if (!hasInteractiveChildren) return _children; // No need to focus trap if no children are interactive return ( {children}