aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx20
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx4
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx4
3 files changed, 13 insertions, 15 deletions
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<CollectionFreeFormInfoStateProps> {
_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<CollectionFreeF
{ fireImmediately: true }
)
);
+ };
+
+ componentDidMount(): void {
+ this.initState();
}
componentWillUpdate() {
- this._disposers.map(disposer => 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 <div className="infoUI">{this.props.state.Message}</div>;
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<CollectionFreeForm
const { links, docs } = arc;
if (docs.length === 0) this.currState = this.state0;
if (docs.length === 1) this.currState = this.state1;
- if (links.length) this.currState = this.state3;
+ if (links?.length) this.currState = this.state3;
},
},
],
@@ -79,7 +79,7 @@ export class CollectionFreeFormInfoUI extends React.Component<CollectionFreeForm
actions: arc => {
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<Partial<collection
return anchor;
};
- infoUI = () => {
- return <CollectionFreeFormInfoUI Document={this.Document} Freeform={this}></CollectionFreeFormInfoUI>;
- }; // this.props.PanelWidth(), this.props.PanelHeight()
+ infoUI = () => <CollectionFreeFormInfoUI Document={this.Document} Freeform={this} />;
componentDidMount() {
this.props.setContentView?.(this);