diff options
| author | Bob Zeleznik <zzzman@gmail.com> | 2020-04-01 17:15:14 -0400 |
|---|---|---|
| committer | Bob Zeleznik <zzzman@gmail.com> | 2020-04-01 17:15:14 -0400 |
| commit | 4859d4e3f5827c3341d43d19a5309d2ec25ab67b (patch) | |
| tree | c1afb8631bbad43f690b9dac0be8d6e326f025ee /src/client/views/collections/CollectionStaffView.tsx | |
| parent | 0a6a4fae448cb4948bc0e8eab9de6309a4af6d22 (diff) | |
fixed warnings and some compile errors. Made a key value layout and extened DocumentBox to have a childLayoutKey field
Diffstat (limited to 'src/client/views/collections/CollectionStaffView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionStaffView.tsx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/client/views/collections/CollectionStaffView.tsx b/src/client/views/collections/CollectionStaffView.tsx index 8c7e113b2..5b9a69bf7 100644 --- a/src/client/views/collections/CollectionStaffView.tsx +++ b/src/client/views/collections/CollectionStaffView.tsx @@ -1,22 +1,20 @@ import { CollectionSubView } from "./CollectionSubView"; -import { Transform } from "../../util/Transform"; import React = require("react"); import { computed, action, IReactionDisposer, reaction, runInAction, observable } from "mobx"; -import { Doc } from "../../../new_fields/Doc"; import { NumCast } from "../../../new_fields/Types"; import "./CollectionStaffView.scss"; import { observer } from "mobx-react"; @observer export class CollectionStaffView extends CollectionSubView(doc => doc) { - private getTransform = (): Transform => this.props.ScreenToLocalTransform().translate(0, -this._mainCont.current!.scrollTop); - private _mainCont = React.createRef<HTMLDivElement>(); private _reactionDisposer: IReactionDisposer | undefined; @observable private _staves = NumCast(this.props.Document.staves); + componentWillUnmount() { + this._reactionDisposer?.(); + } componentDidMount = () => { - this._reactionDisposer = reaction( - () => NumCast(this.props.Document.staves), + this._reactionDisposer = reaction(() => NumCast(this.props.Document.staves), (staves) => runInAction(() => this._staves = staves) ); @@ -47,7 +45,7 @@ export class CollectionStaffView extends CollectionSubView(doc => doc) { } render() { - return <div className="collectionStaffView" ref={this._mainCont}> + return <div className="collectionStaffView"> {this.staves} {this.addStaffButton} </div>; |
