From ed03e91e3d7b208f6fa4c035f7259efc6fad61c6 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 10 Apr 2019 12:37:24 +0200 Subject: [PATCH] perf(services): avoid rerenders for version column Closes DCOS-51377 --- .../js/columns/ServicesTableVersionColumn.tsx | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/plugins/services/src/js/columns/ServicesTableVersionColumn.tsx b/plugins/services/src/js/columns/ServicesTableVersionColumn.tsx index 3d97f598cb..4228cfcfd2 100644 --- a/plugins/services/src/js/columns/ServicesTableVersionColumn.tsx +++ b/plugins/services/src/js/columns/ServicesTableVersionColumn.tsx @@ -8,6 +8,22 @@ import Service from "../structs/Service"; import ServiceTree from "../structs/ServiceTree"; import { SortDirection } from "plugins/services/src/js/types/SortDirection"; +const ServiceVersion = React.memo( + ({ + rawVersion, + displayVersion + }: { + rawVersion: string; + displayVersion: string; + }) => ( + + + {displayVersion} + + + ) +); + export function versionRenderer( service: Service | Pod | ServiceTree ): React.ReactNode { @@ -17,11 +33,10 @@ export function versionRenderer( } return ( - - - {version.displayVersion} - - + ); }