Skip to content

Commit 2a4ca3d

Browse files
committed
fix: use ref in Button component
1 parent 9ca6b78 commit 2a4ca3d

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/components/ResourceBrowser/ResourceList/NodeActionsMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ const NodeActionsMenu = forwardRef<HTMLButtonElement, NodeActionsMenuProps>(
189189
position="right"
190190
>
191191
<Button
192-
buttonRef={forwardedRef}
192+
ref={forwardedRef}
193193
dataTestId={`node-actions-button-${nodeData.name}`}
194194
icon={<MenuDots className="fcn-7" />}
195195
variant={ButtonVariantType.borderLess}

src/components/ResourceBrowser/ResourceList/ResourceBrowserActionMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ const ResourceBrowserActionMenu = forwardRef(
197197
]}
198198
>
199199
<Button
200-
buttonRef={forwardedRef}
200+
ref={forwardedRef}
201201
dataTestId={`node-actions-button-${id}`}
202202
icon={<MenuDots className="fcn-7" />}
203203
variant={ButtonVariantType.borderLess}

src/components/ResourceBrowser/ResourceList/Sidebar.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ const Sidebar = ({ apiResources, selectedResource, updateK8sResourceTab }: Sideb
5555
const [list, setList] = useState(convertResourceGroupListToK8sObjectList(apiResources || null, kind))
5656
const preventScrollRef = useRef(false)
5757
const searchInputRef = useRef<Select<K8sObjectOptionType, false, GroupBase<K8sObjectOptionType>>>(null)
58-
const k8sObjectOptionsList = useMemo(() => convertK8sObjectMapToOptionsList(list), [list])
58+
const k8sObjectOptionsList = useMemo(
59+
() => convertK8sObjectMapToOptionsList(convertResourceGroupListToK8sObjectList(apiResources || null, kind)),
60+
[apiResources],
61+
)
5962
const sortedK8sObjectOptionsList = useMemo(() => {
6063
if (!searchText) {
6164
return k8sObjectOptionsList
@@ -149,7 +152,7 @@ const Sidebar = ({ apiResources, selectedResource, updateK8sResourceTab }: Sideb
149152

150153
useEffect(() => {
151154
/* NOTE: this effect accommodates for user navigating through browser history (push) */
152-
if (kind === selectedResource?.gvk.Kind.toLowerCase() || !k8sObjectOptionsList.length) {
155+
if (!k8sObjectOptionsList.length) {
153156
return
154157
}
155158
/* NOTE: match will never be null; due to node fallback */

0 commit comments

Comments
 (0)