Skip to content

Commit c55e7f1

Browse files
authored
[STREAM-987] Memoize conversations so they don't change on every render (#952)
1 parent bd83f9a commit c55e7f1

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

66
# [Unreleased](https://github.com/MyPureCloud/genesys-cloud-webrtc-sdk/compare/v11.3.2...HEAD)
7+
### Fixed
8+
* [STREAM-987](https://inindca.atlassian.net/browse/STREAM-987) - Demo app: Memoize conversations so they don't change every render when nothing has changed
79

810
# [v11.3.2](https://github.com/MyPureCloud/genesys-cloud-webrtc-sdk/compare/v11.3.1...v11.3.2)
911
### Changed

react-demo-app/src/components/ActiveConversationsTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState, useEffect } from 'react';
1+
import { useState, useEffect, useMemo } from 'react';
22
import useSdk from '../hooks/useSdk';
33
import './ActiveConversationsTable.css';
44
import { GuxButton, GuxTable, GuxRadialLoading } from 'genesys-spark-components-react';
@@ -12,7 +12,7 @@ export default function ActiveConversationsTable() {
1212
const conversationsObj = useSelector(
1313
(state: RootState) => state.conversations.activeConversations
1414
);
15-
const conversations = Object.values(conversationsObj);
15+
const conversations = useMemo(() => Object.values(conversationsObj), [conversationsObj]);
1616
const { endSession, toggleAudioMute, toggleHoldState } = useSdk();
1717
const [holdLabels, setHoldLabels ] = useState<Array<string | JSX.Element>>([]);
1818
const [muteLabels, setMuteLabels ] = useState<Array<string | JSX.Element>>([]);

0 commit comments

Comments
 (0)