Fixed entity chip navigate (#5587)
Fixed EntityChip, navigate had been removed during performance optimization, I put it back.
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { useTheme } from '@emotion/react';
|
import { useTheme } from '@emotion/react';
|
||||||
import { isNonEmptyString } from '@sniptt/guards';
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
|
|
||||||
@ -33,11 +34,13 @@ export const EntityChip = ({
|
|||||||
LeftIcon,
|
LeftIcon,
|
||||||
className,
|
className,
|
||||||
}: EntityChipProps) => {
|
}: EntityChipProps) => {
|
||||||
|
const navigate = useNavigate();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const handleLinkClick = (event: React.MouseEvent<HTMLDivElement>) => {
|
const handleLinkClick = (event: React.MouseEvent<HTMLDivElement>) => {
|
||||||
if (isNonEmptyString(linkToEntity)) {
|
if (isNonEmptyString(linkToEntity)) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
navigate(linkToEntity);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user