1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: console errors from highlight component and tag key prop placement (#8669)

Addressing some oversights that led to browser console errors.

This PR fixes console errors related to the recently introduced
highlight component (#8643) and tag row component in the new flag
metadata panel (#8663).
This commit is contained in:
Nuno Góis 2024-11-06 11:09:33 +00:00 committed by GitHub
parent 314a4d7113
commit 328fac39a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 11 deletions

View File

@ -1,5 +1,5 @@
import { alpha, styled } from '@mui/material';
import type { ReactNode } from 'react';
import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';
import { useHighlightContext } from './HighlightContext';
import type { HighlightKey } from './HighlightProvider';
@ -27,17 +27,23 @@ const StyledHighlight = styled('div', {
},
}));
interface IHighlightProps {
interface IHighlightProps extends HTMLAttributes<HTMLDivElement> {
highlightKey: HighlightKey;
children: ReactNode;
}
export const Highlight = ({ highlightKey, children }: IHighlightProps) => {
const { isHighlighted } = useHighlightContext();
export const Highlight = forwardRef<HTMLDivElement, IHighlightProps>(
({ highlightKey, children, ...props }, ref) => {
const { isHighlighted } = useHighlightContext();
return (
<StyledHighlight highlighted={isHighlighted(highlightKey)}>
{children}
</StyledHighlight>
);
};
return (
<StyledHighlight
ref={ref}
highlighted={isHighlighted(highlightKey)}
{...props}
>
{children}
</StyledHighlight>
);
},
);

View File

@ -128,13 +128,13 @@ export const TagRow = ({ feature }: IFeatureOverviewSidePanelTagsProps) => {
const tagLabel = `${tag.type}:${tag.value}`;
return (
<Tooltip
key={tagLabel}
title={
tagLabel.length > 35 ? tagLabel : ''
}
arrow
>
<StyledAddedTag
key={tagLabel}
label={tagLabel}
size='small'
deleteIcon={