From d33aab9fb61f96c9e3a91f2d9890885d97ebbae6 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Thu, 5 May 2022 11:21:02 +0300 Subject: [PATCH] fix tool rerender --- .../MultipleChoiceDropDown.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wax-prosemirror-services/src/WaxToolGroups/MultipleChoiceDropDownToolGroupService/MultipleChoiceDropDown.js b/wax-prosemirror-services/src/WaxToolGroups/MultipleChoiceDropDownToolGroupService/MultipleChoiceDropDown.js index dd9b97391..f04cb39f5 100644 --- a/wax-prosemirror-services/src/WaxToolGroups/MultipleChoiceDropDownToolGroupService/MultipleChoiceDropDown.js +++ b/wax-prosemirror-services/src/WaxToolGroups/MultipleChoiceDropDownToolGroupService/MultipleChoiceDropDown.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useMemo } from 'react'; import { injectable, inject } from 'inversify'; import { isEmpty } from 'lodash'; import { v4 as uuidv4 } from 'uuid'; @@ -26,10 +26,13 @@ class MultipleChoiceDropDown extends ToolGroup { renderTools(view) { if (isEmpty(view)) return null; - return ( - // eslint-disable-next-line no-underscore-dangle - <DropDownComponent key={uuidv4()} tools={this._tools} view={view} /> + const MultipleDropDown = useMemo( + () => ( + <DropDownComponent key={uuidv4()} tools={this._tools} view={view} /> + ), + [], ); + return MultipleDropDown; } } -- GitLab