aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-12-10 20:19:27 -0500
committerbobzel <zzzman@gmail.com>2023-12-10 20:19:27 -0500
commit380ee1acac1c0b7972d7d423cf804af146dc0edf (patch)
tree1d77244a600e6eb1fb6d56356b3ce01ca6add89d /src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx
parentb7b7105fac83ec11480204c5c7ac0ae6579774e1 (diff)
massive changes to use mobx 6 which means not accessing props directly in @computed functions.
Diffstat (limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx
index 3ba7aedef..dd7e12e41 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx
@@ -1,6 +1,7 @@
-import { IReactionDisposer, reaction } from 'mobx';
+import { IReactionDisposer, makeObservable, observable, reaction } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
+import { copyProps } from '../../../../Utils';
import './CollectionFreeFormView.scss';
/**
@@ -49,8 +50,16 @@ export interface CollectionFreeFormInfoStateProps {
export class CollectionFreeFormInfoState extends React.Component<CollectionFreeFormInfoStateProps> {
_disposers: IReactionDisposer[] = [];
+ _prevProps: React.PropsWithChildren<CollectionFreeFormInfoStateProps>;
+ @observable _props: React.PropsWithChildren<CollectionFreeFormInfoStateProps>;
+ constructor(props: React.PropsWithChildren<CollectionFreeFormInfoStateProps>) {
+ super(props);
+ this._props = this._prevProps = props;
+ makeObservable(this);
+ }
+
get State() {
- return this.props.infoState;
+ return this._props.infoState;
}
get Arcs() {
return Object.keys(this.State).map(key => this.State[key]);
@@ -65,7 +74,7 @@ export class CollectionFreeFormInfoState extends React.Component<CollectionFreeF
res => {
if (res) {
const next = arc.act(res);
- this.props.next(next);
+ this._props.next(next);
}
},
{ fireImmediately: true }
@@ -76,6 +85,7 @@ export class CollectionFreeFormInfoState extends React.Component<CollectionFreeF
this.initState();
}
componentDidUpdate() {
+ copyProps(this);
this.clearState();
this.initState();
}