From 380ee1acac1c0b7972d7d423cf804af146dc0edf Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Sun, 10 Dec 2023 20:19:27 -0500
Subject: massive changes to use mobx 6 which means not accessing props
 directly in @computed functions.

---
 .../collectionFreeForm/CollectionFreeFormInfoState.tsx   | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

(limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoState.tsx')

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();
     }
-- 
cgit v1.2.3-70-g09d2

