diff --git a/web-console/src/components/action-cell/action-cell.tsx b/web-console/src/components/action-cell/action-cell.tsx index 6b13dd84102..2bc8988df00 100644 --- a/web-console/src/components/action-cell/action-cell.tsx +++ b/web-console/src/components/action-cell/action-cell.tsx @@ -34,7 +34,7 @@ export interface ActionCellProps { actions?: BasicAction[]; } -export function ActionCell(props: ActionCellProps) { +export const ActionCell = React.memo(function ActionCell(props: ActionCellProps) { const { onDetail, actions } = props; const actionsMenu = actions ? basicActionsToMenu(actions) : null; @@ -48,4 +48,4 @@ export function ActionCell(props: ActionCellProps) { )} ); -} +}); diff --git a/web-console/src/components/action-icon/action-icon.tsx b/web-console/src/components/action-icon/action-icon.tsx index 36e558d365d..6e16883a898 100644 --- a/web-console/src/components/action-icon/action-icon.tsx +++ b/web-console/src/components/action-icon/action-icon.tsx @@ -28,8 +28,8 @@ export interface ActionIconProps { onClick?: () => void; } -export function ActionIcon(props: ActionIconProps) { +export const ActionIcon = React.memo(function ActionIcon(props: ActionIconProps) { const { className, icon, onClick } = props; return ; -} +}); diff --git a/web-console/src/components/center-message/center-message.tsx b/web-console/src/components/center-message/center-message.tsx index a600ddfd52c..206f68d7e5f 100644 --- a/web-console/src/components/center-message/center-message.tsx +++ b/web-console/src/components/center-message/center-message.tsx @@ -24,7 +24,7 @@ export interface CenterMessageProps { children?: ReactNode; } -export function CenterMessage(props: CenterMessageProps) { +export const CenterMessage = React.memo(function CenterMessage(props: CenterMessageProps) { const { children } = props; return ( @@ -32,4 +32,4 @@ export function CenterMessage(props: CenterMessageProps) {
{children}
); -} +}); diff --git a/web-console/src/components/clearable-input/clearable-input.tsx b/web-console/src/components/clearable-input/clearable-input.tsx index 1764e69c239..9ea33a1bef6 100644 --- a/web-console/src/components/clearable-input/clearable-input.tsx +++ b/web-console/src/components/clearable-input/clearable-input.tsx @@ -28,7 +28,7 @@ export interface ClearableInputProps { placeholder: string; } -export function ClearableInput(props: ClearableInputProps) { +export const ClearableInput = React.memo(function ClearableInput(props: ClearableInputProps) { const { className, value, onChange, placeholder } = props; return ( @@ -42,4 +42,4 @@ export function ClearableInput(props: ClearableInputProps) { placeholder={placeholder} /> ); -} +}); diff --git a/web-console/src/components/deferred/deferred.tsx b/web-console/src/components/deferred/deferred.tsx index e12ad1bd844..38264483171 100644 --- a/web-console/src/components/deferred/deferred.tsx +++ b/web-console/src/components/deferred/deferred.tsx @@ -16,10 +16,12 @@ * limitations under the License. */ +import React from 'react'; + export interface DeferredProps { content: () => JSX.Element; } -export function Deferred(props: DeferredProps) { +export const Deferred = React.memo(function Deferred(props: DeferredProps) { return props.content(); -} +}); diff --git a/web-console/src/components/external-link/external-link.tsx b/web-console/src/components/external-link/external-link.tsx index b8127621126..f79d7507efe 100644 --- a/web-console/src/components/external-link/external-link.tsx +++ b/web-console/src/components/external-link/external-link.tsx @@ -23,7 +23,7 @@ export interface ExternalLinkProps { children?: ReactNode; } -export function ExternalLink(props: ExternalLinkProps) { +export const ExternalLink = React.memo(function ExternalLink(props: ExternalLinkProps) { const { href, children } = props; return ( @@ -31,4 +31,4 @@ export function ExternalLink(props: ExternalLinkProps) { {children} ); -} +}); diff --git a/web-console/src/components/header-bar/header-bar.tsx b/web-console/src/components/header-bar/header-bar.tsx index 7b78bf2f74d..12b4a756c03 100644 --- a/web-console/src/components/header-bar/header-bar.tsx +++ b/web-console/src/components/header-bar/header-bar.tsx @@ -132,7 +132,7 @@ export interface HeaderBarProps { hideLegacy: boolean; } -export function HeaderBar(props: HeaderBarProps) { +export const HeaderBar = React.memo(function HeaderBar(props: HeaderBarProps) { const { active, hideLegacy } = props; const [aboutDialogOpen, setAboutDialogOpen] = useState(false); const [doctorDialogOpen, setDoctorDialogOpen] = useState(false); @@ -264,4 +264,4 @@ export function HeaderBar(props: HeaderBarProps) { )} ); -} +}); diff --git a/web-console/src/components/loader/loader.tsx b/web-console/src/components/loader/loader.tsx index a182d2fcb1f..36c4498c55b 100644 --- a/web-console/src/components/loader/loader.tsx +++ b/web-console/src/components/loader/loader.tsx @@ -25,7 +25,7 @@ export interface LoaderProps { loading?: boolean; // This is needed so that this component can be used as a LoadingComponent in react table } -export function Loader(props: LoaderProps) { +export const Loader = React.memo(function Loader(props: LoaderProps) { const { loadingText, loading } = props; if (!loading) return null; @@ -59,4 +59,4 @@ export function Loader(props: LoaderProps) { ); -} +}); diff --git a/web-console/src/components/refresh-button/refresh-button.tsx b/web-console/src/components/refresh-button/refresh-button.tsx index 5d0df279e82..180316159a3 100644 --- a/web-console/src/components/refresh-button/refresh-button.tsx +++ b/web-console/src/components/refresh-button/refresh-button.tsx @@ -27,7 +27,7 @@ export interface RefreshButtonProps { localStorageKey?: LocalStorageKeys; } -export function RefreshButton(props: RefreshButtonProps) { +export const RefreshButton = React.memo(function RefreshButton(props: RefreshButtonProps) { const { onRefresh, localStorageKey } = props; const intervals = [ { label: '5 seconds', value: 5000 }, @@ -49,4 +49,4 @@ export function RefreshButton(props: RefreshButtonProps) { localStorageKey={localStorageKey} /> ); -} +}); diff --git a/web-console/src/components/rule-editor/rule-editor.tsx b/web-console/src/components/rule-editor/rule-editor.tsx index 7c12f156832..be8a738de57 100644 --- a/web-console/src/components/rule-editor/rule-editor.tsx +++ b/web-console/src/components/rule-editor/rule-editor.tsx @@ -43,7 +43,7 @@ export interface RuleEditorProps { moveDown: (() => void) | null; } -export function RuleEditor(props: RuleEditorProps) { +export const RuleEditor = React.memo(function RuleEditor(props: RuleEditorProps) { const { rule, onChange, tiers, onDelete, moveUp, moveDown } = props; const [isOpen, setIsOpen] = useState(true); if (!rule) return null; @@ -223,4 +223,4 @@ export function RuleEditor(props: RuleEditorProps) { ); -} +}); diff --git a/web-console/src/components/show-value/show-value.tsx b/web-console/src/components/show-value/show-value.tsx index 9e161e87af2..59afd2f07de 100644 --- a/web-console/src/components/show-value/show-value.tsx +++ b/web-console/src/components/show-value/show-value.tsx @@ -30,7 +30,7 @@ export interface ShowValueProps { jsonValue?: string; } -export function ShowValue(props: ShowValueProps) { +export const ShowValue = React.memo(function ShowValue(props: ShowValueProps) { const { endpoint, downloadFilename, jsonValue } = props; return (
@@ -57,4 +57,4 @@ export function ShowValue(props: ShowValueProps) {
); -} +}); diff --git a/web-console/src/components/table-cell/table-cell.tsx b/web-console/src/components/table-cell/table-cell.tsx index d02aeca5a76..e252cc9cc34 100644 --- a/web-console/src/components/table-cell/table-cell.tsx +++ b/web-console/src/components/table-cell/table-cell.tsx @@ -51,7 +51,7 @@ export interface TableCellProps { unparseable?: boolean; } -export function TableCell(props: TableCellProps): JSX.Element { +export const TableCell = React.memo(function TableCell(props: TableCellProps) { const { value, timestamp, unparseable } = props; const [showValue, setShowValue] = useState(); @@ -97,4 +97,4 @@ export function TableCell(props: TableCellProps): JSX.Element { return null; } } -} +}); diff --git a/web-console/src/components/table-column-selector/table-column-selector.tsx b/web-console/src/components/table-column-selector/table-column-selector.tsx index 4e006bc85da..1602afa9538 100644 --- a/web-console/src/components/table-column-selector/table-column-selector.tsx +++ b/web-console/src/components/table-column-selector/table-column-selector.tsx @@ -30,7 +30,9 @@ interface TableColumnSelectorProps { tableColumnsHidden: string[]; } -export function TableColumnSelector(props: TableColumnSelectorProps) { +export const TableColumnSelector = React.memo(function TableColumnSelector( + props: TableColumnSelectorProps, +) { const { columns, onChange, tableColumnsHidden } = props; const checkboxes = ( @@ -54,4 +56,4 @@ export function TableColumnSelector(props: TableColumnSelectorProps) {