From 7ab59e7a27b6eff6bf9a6ea260fc70d0a2f3c79f Mon Sep 17 00:00:00 2001 From: Rohit Bansal <40559587+Rohit3523@users.noreply.github.com> Date: Sun, 11 Jan 2026 02:35:14 +0530 Subject: [PATCH 1/2] memoize timestamp value --- .../markdown/components/Timestamp.tsx | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/containers/markdown/components/Timestamp.tsx b/app/containers/markdown/components/Timestamp.tsx index 31731c322a3..0c8bd061375 100644 --- a/app/containers/markdown/components/Timestamp.tsx +++ b/app/containers/markdown/components/Timestamp.tsx @@ -14,44 +14,44 @@ interface ITimestampProps { const Timestamp = ({ value }: ITimestampProps): React.ReactElement => { const { colors } = useTheme(); - const formatDate = React.useMemo(() => { - const timestamp = parseInt(value.timestamp) * 1000; + const timestampMs = React.useMemo(() => parseInt(value.timestamp, 10) * 1000, [value.timestamp]); + const formatDate = React.useMemo(() => { if (value.format === 't') { - return dayjs(timestamp).format('hh:mm A'); + return dayjs(timestampMs).format('hh:mm A'); } if (value.format === 'T') { - return dayjs(timestamp).format('hh:mm:ss A'); + return dayjs(timestampMs).format('hh:mm:ss A'); } if (value.format === 'd') { - return dayjs(timestamp).format('MM/DD/YYYY'); + return dayjs(timestampMs).format('MM/DD/YYYY'); } if (value.format === 'D') { - return dayjs(timestamp).format('dddd, MMM DD, YYYY'); + return dayjs(timestampMs).format('dddd, MMM DD, YYYY'); } if (value.format === 'f') { - return dayjs(timestamp).format('dddd, MMM DD, YYYY hh:mm A'); + return dayjs(timestampMs).format('dddd, MMM DD, YYYY hh:mm A'); } if (value.format === 'F') { - return dayjs(timestamp).format('dddd, MMM DD, YYYY hh:mm:ss A'); + return dayjs(timestampMs).format('dddd, MMM DD, YYYY hh:mm:ss A'); } if (value.format === 'R') { - return dayjs(timestamp).fromNow(); + return dayjs(timestampMs).fromNow(); } return 'Invalid Date'; - }, [value]); + }, [timestampMs, value.format]); const handlePress = React.useCallback(() => { - const message = dayjs(parseInt(value.timestamp) * 1000).format('dddd, MMM DD, YYYY hh:mm A'); + const message = dayjs(timestampMs).format('dddd, MMM DD, YYYY hh:mm A'); EventEmitter.emit(LISTENER, { message }); - }, [value.timestamp]); + }, [timestampMs]); return ( Date: Sun, 11 Jan 2026 02:36:02 +0530 Subject: [PATCH 2/2] code format --- app/containers/markdown/components/Timestamp.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/containers/markdown/components/Timestamp.tsx b/app/containers/markdown/components/Timestamp.tsx index 0c8bd061375..da760661b3c 100644 --- a/app/containers/markdown/components/Timestamp.tsx +++ b/app/containers/markdown/components/Timestamp.tsx @@ -14,7 +14,7 @@ interface ITimestampProps { const Timestamp = ({ value }: ITimestampProps): React.ReactElement => { const { colors } = useTheme(); - const timestampMs = React.useMemo(() => parseInt(value.timestamp, 10) * 1000, [value.timestamp]); + const timestampMs = React.useMemo(() => parseInt(value.timestamp, 10) * 1000, [value.timestamp]); const formatDate = React.useMemo(() => { if (value.format === 't') {