diff --git a/wax-prosemirror-components/src/components/trackChanges/TrackChangeOptionsTool.js b/wax-prosemirror-components/src/components/trackChanges/TrackChangeOptionsTool.js index 640597119d31a05387aca7be400334e8089b1830..b5924629a2bbb0778e616d38e2747be86fb13bb2 100644 --- a/wax-prosemirror-components/src/components/trackChanges/TrackChangeOptionsTool.js +++ b/wax-prosemirror-components/src/components/trackChanges/TrackChangeOptionsTool.js @@ -1,4 +1,4 @@ -import React, { useMemo, useState, useRef } from 'react'; +import React, { useMemo, useState, useRef, useEffect } from 'react'; import styled from 'styled-components'; import { grid } from '@pubsweet/ui-toolkit'; diff --git a/wax-prosemirror-services/src/WaxToolGroups/TrackCommentOptionsToolGroupService/TrackCommentOptions.js b/wax-prosemirror-services/src/WaxToolGroups/TrackCommentOptionsToolGroupService/TrackCommentOptions.js index ccbaffe19c46d715a4922faacc2ed86bef9bf46f..893387826c16405f84a084cff033f2e85ff03426 100644 --- a/wax-prosemirror-services/src/WaxToolGroups/TrackCommentOptionsToolGroupService/TrackCommentOptions.js +++ b/wax-prosemirror-services/src/WaxToolGroups/TrackCommentOptionsToolGroupService/TrackCommentOptions.js @@ -22,16 +22,21 @@ class TrackCommentOptions extends ToolGroup { renderTools(view) { if (isEmpty(view)) return null; - return ( - <TrackChangeOptionsTool - key={uuidv4()} - view={view} - groups={this._toolGroups[0].groups.map(group => ({ - // groupName: group.title.props.title, - items: group._tools, - }))} - /> + + const MemorizedComponent = useMemo( + () => ( + <TrackChangeOptionsTool + key={uuidv4()} + view={view} + groups={this._toolGroups[0].groups.map(group => ({ + // groupName: group.title.props.title, + items: group._tools, + }))} + /> + ), + [], ); + return MemorizedComponent; } }