From dfd422cf97913c4df13add0acfb61af366dd77b3 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Fri, 16 Oct 2020 20:41:49 +0300 Subject: [PATCH] fix rerender --- .../src/components/findAndReplace/FindAndReplaceComponent.js | 2 +- .../src/components/findAndReplace/FindAndReplaceTool.js | 2 +- wax-prosemirror-core/src/WaxView.js | 2 +- wax-prosemirror-services/src/lib/ToolGroup.js | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/wax-prosemirror-components/src/components/findAndReplace/FindAndReplaceComponent.js b/wax-prosemirror-components/src/components/findAndReplace/FindAndReplaceComponent.js index ec6c74c08..ef0b5d065 100644 --- a/wax-prosemirror-components/src/components/findAndReplace/FindAndReplaceComponent.js +++ b/wax-prosemirror-components/src/components/findAndReplace/FindAndReplaceComponent.js @@ -11,7 +11,7 @@ const FindAndReplaceComponent = ({ close }) => { const [isExpanded, setExpanded] = useState(false); const expand = () => { - setExpanded(!isExpanded); + setExpanded(true); }; return isExpanded ? ( diff --git a/wax-prosemirror-components/src/components/findAndReplace/FindAndReplaceTool.js b/wax-prosemirror-components/src/components/findAndReplace/FindAndReplaceTool.js index 5e4724e45..0f721a2c7 100644 --- a/wax-prosemirror-components/src/components/findAndReplace/FindAndReplaceTool.js +++ b/wax-prosemirror-components/src/components/findAndReplace/FindAndReplaceTool.js @@ -82,7 +82,7 @@ const FindAndReplaceTool = ({ view = {}, item }) => { )} </Wrapper> ), - [isOpen, styles], + [isOpen, style], ); return MemorizedDropdown; diff --git a/wax-prosemirror-core/src/WaxView.js b/wax-prosemirror-core/src/WaxView.js index d8722a6a8..43147ae4e 100644 --- a/wax-prosemirror-core/src/WaxView.js +++ b/wax-prosemirror-core/src/WaxView.js @@ -58,7 +58,7 @@ export default props => { if (autoFocus) setTimeout(() => { view.focus(); - }); + }, 1000); return () => view.destroy(); } diff --git a/wax-prosemirror-services/src/lib/ToolGroup.js b/wax-prosemirror-services/src/lib/ToolGroup.js index efe1c529b..3ab8f96c5 100644 --- a/wax-prosemirror-services/src/lib/ToolGroup.js +++ b/wax-prosemirror-services/src/lib/ToolGroup.js @@ -2,6 +2,7 @@ import React, { useMemo } from 'react'; import { injectable } from 'inversify'; import { ToolGroupComponent, ToolGroups } from 'wax-prosemirror-components'; import { v4 as uuidv4 } from 'uuid'; +import { isEmpty } from 'lodash'; export default @injectable() @@ -57,6 +58,8 @@ class ToolGroup { } renderTools(view) { + if (isEmpty(view)) return null; + const { name } = this.constructor; if (this._toolGroups > 0) { return <ToolGroups toolGroups={this._toolGroups} view={view} />; @@ -72,7 +75,7 @@ class ToolGroup { name={name} /> ), - [view], + [], ); return MemorizedToolGroupComponent; -- GitLab