From df4c0931b6596d7b43a091f7ab5474d47c4f4ab4 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 6 Dec 2023 22:54:43 -0500 Subject: cleanup --- .../CollectionFreeFormInfoState.tsx | 20 ++++++++++---------- .../collectionFreeForm/CollectionFreeFormInfoUI.tsx | 4 ++-- .../collectionFreeForm/CollectionFreeFormView.tsx | 4 +--- 3 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx index bf47820a1..baf91da32 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx @@ -23,7 +23,9 @@ export interface CollectionFreeFormInfoStateProps { @observer export class CollectionFreeFormInfoState extends React.Component { _disposers: IReactionDisposer[] = []; - componentDidMount(): void { + + clearState = () => this._disposers.map(disposer => disposer()); + initState = () => { this._disposers = this.props.state.Arcs.map(arc => reaction( () => arc.events(), @@ -31,19 +33,17 @@ export class CollectionFreeFormInfoState extends React.Component disposer()); - this._disposers = this.props.state.Arcs.map(arc => - reaction( - () => arc.events(), - args => arc.actions(args), - { fireImmediately: true } - ) - ); + this.clearState(); + this.initState(); } componentWillUnmount(): void { - this._disposers.map(disposer => disposer()); + this.clearState(); } render() { return
{this.props.state.Message}
; diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx index 8b2b32581..dfe77482f 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx @@ -65,7 +65,7 @@ export class CollectionFreeFormInfoUI extends React.Component { const { links, viewingLinks } = arc; if (viewingLinks) this.currState = this.state4; - if (links.length === 0) this.currState = this.state2; + if (links?.length === 0) this.currState = this.state2; }, }, ], diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index e432c9682..91617ec44 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1429,9 +1429,7 @@ export class CollectionFreeFormView extends CollectionSubView { - return ; - }; // this.props.PanelWidth(), this.props.PanelHeight() + infoUI = () => ; componentDidMount() { this.props.setContentView?.(this); -- cgit v1.2.3-70-g09d2