Skip to content

Commit 0c15444

Browse files
committed
fix: SelecPicker: tooltipProps null check
1 parent 901f32e commit 0c15444

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.3.22-beta-1",
3+
"version": "0.3.22-beta-3",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/SelectPicker/common.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,22 @@ import { TooltipProps } from '@Common/Tooltip/types'
4141
import { SelectPickerGroupHeadingProps, SelectPickerOptionType, SelectPickerProps } from './type'
4242
import { getGroupCheckboxValue } from './utils'
4343

44-
const getTooltipProps = (tooltipProps: SelectPickerOptionType['tooltipProps']): TooltipProps => {
45-
if (Object.hasOwn(tooltipProps, 'shortcutKeyCombo') && 'shortcutKeyCombo' in tooltipProps) {
46-
return tooltipProps
44+
const getTooltipProps = (tooltipProps: SelectPickerOptionType['tooltipProps'] = {}): TooltipProps => {
45+
if (tooltipProps) {
46+
if (Object.hasOwn(tooltipProps, 'shortcutKeyCombo') && 'shortcutKeyCombo' in tooltipProps) {
47+
return tooltipProps
48+
}
49+
50+
return {
51+
// TODO: using some typing somersaults here, clean it up later
52+
alwaysShowTippyOnHover: !!(tooltipProps as Required<Pick<TooltipProps, 'content'>>)?.content,
53+
...(tooltipProps as Required<Pick<TooltipProps, 'content'>>),
54+
}
4755
}
4856

4957
return {
50-
// TODO: using some typing somersaults here, clean it up later
51-
alwaysShowTippyOnHover: !!(tooltipProps as Required<Pick<TooltipProps, 'content'>>)?.content,
52-
...(tooltipProps as Required<Pick<TooltipProps, 'content'>>),
58+
alwaysShowTippyOnHover: false,
59+
content: null,
5360
}
5461
}
5562

0 commit comments

Comments
 (0)