From 26542f23c1d8159c9cf6fd4b29c339ea2b41a1f2 Mon Sep 17 00:00:00 2001 From: Johannes Klein Agents Date: Sun, 15 Nov 2026 22:07:19 +0100 Subject: [PATCH 1/3] Bump to MobX 6 with decorators kept (#146) mobx 6.16 and mobx-react-lite 4.1; makeObservable( this ) in every decorated class, override on the three subclass members that replace a parent's, define semantics for class fields in Babel, Jest and tsconfig. computed-async-mobx 7 mixes decorators with annotations, which MobX 6 rejects, so Run uses a small local promisedComputed on mobx-utils 6. MobX 6 passes the previous value, not the reaction, as the second effect argument; Partition's one-shot reaction takes the third. StoreBase.dispose is a method so Alignment's decorated dispose does not redefine a field. Co-Authored-By: Claude Sonnet 5.5 --- .babelrc | 2 +- electron.vite.config.js | 2 +- jest/babelTransform.js | 2 +- jest/setup.js | 4 +++ package.json | 7 ++-- src/app/promisedComputed.js | 59 +++++++++++++++++++++++++++++++ src/app/store/Alignment.js | 15 ++++---- src/app/store/AlignmentOptions.js | 10 ++++-- src/app/store/AppStore.js | 6 +++- src/app/store/AstralTree.js | 6 +++- src/app/store/Citation.js | 5 ++- src/app/store/Config.js | 3 +- src/app/store/FinalAlignment.js | 3 +- src/app/store/FinalPartition.js | 3 +- src/app/store/InputFile.js | 3 +- src/app/store/Option.js | 3 +- src/app/store/PartOptions.js | 9 ++++- src/app/store/Partition.js | 6 ++-- src/app/store/Run.js | 5 +-- src/app/store/RunList.js | 3 +- src/app/store/RunOptions.js | 35 ++++++++++++++++-- src/app/store/StoreBase.js | 5 +-- tsconfig.json | 2 +- yarn.lock | 36 ++++++++++--------- 24 files changed, 181 insertions(+), 53 deletions(-) create mode 100644 src/app/promisedComputed.js diff --git a/.babelrc b/.babelrc index 4e1dc0e1..a981a7ab 100644 --- a/.babelrc +++ b/.babelrc @@ -10,6 +10,6 @@ ], "plugins": [ ["@babel/plugin-proposal-decorators", { "legacy": true }], - ["@babel/plugin-proposal-class-properties", { "loose": true }] + ["@babel/plugin-proposal-class-properties", { "loose": false }] ] } diff --git a/electron.vite.config.js b/electron.vite.config.js index ae6d9f84..631c5fb4 100644 --- a/electron.vite.config.js +++ b/electron.vite.config.js @@ -53,7 +53,7 @@ export default defineConfig( ( { command } ) => ( { babel: { plugins: [ ['@babel/plugin-proposal-decorators', { legacy: true }], - ['@babel/plugin-proposal-class-properties', { loose: true }], + ['@babel/plugin-proposal-class-properties', { loose: false }], ['@babel/plugin-transform-react-jsx', { runtime: 'automatic' }], ], }, diff --git a/jest/babelTransform.js b/jest/babelTransform.js index 3bc5092c..7e13f168 100644 --- a/jest/babelTransform.js +++ b/jest/babelTransform.js @@ -11,7 +11,7 @@ module.exports = babelJest.default.createTransformer( { ], plugins: [ [ '@babel/plugin-proposal-decorators', { legacy: true } ], - [ '@babel/plugin-proposal-class-properties', { loose: true } ], + [ '@babel/plugin-proposal-class-properties', { loose: false } ], [ '@babel/plugin-transform-react-jsx', { runtime: 'automatic' } ], ], } ); diff --git a/jest/setup.js b/jest/setup.js index 2a373e2a..2d6d5929 100644 --- a/jest/setup.js +++ b/jest/setup.js @@ -42,6 +42,10 @@ function withBridgeEvents( next ) { if ( typeof next.getVersion !== 'function' ) { next.getVersion = () => Promise.resolve(); } + // The output panel checks the output name; MobX 6 re-renders it inside the render test when this rejects. + if ( typeof next.checkOutput !== 'function' ) { + next.checkOutput = () => Promise.resolve( { ok: true, resultFilenames: [] } ); + } // Config construction reads and may write dark mode. if ( typeof next.getDarkMode !== 'function' ) { next.getDarkMode = () => Promise.resolve( false ); diff --git a/package.json b/package.json index a3f1b406..3e5f78dd 100644 --- a/package.json +++ b/package.json @@ -63,16 +63,15 @@ "allotment": "^1.20.6", "classnames": "^2.3.2", "clean-stack": "3.0.1", - "computed-async-mobx": "^4.2.0", "d3-array": "^3.2.5", "electron-log": "^4.4.8", "electron-store": "^8.1.0", "electron-updater": "^5.2.4", "filenamify": "^4.3.0", "lodash": "^4.18.1", - "mobx": "^5.15.7", - "mobx-react-lite": "^2.2.2", - "mobx-utils": "^5.6.2", + "mobx": "^6.16.0", + "mobx-react-lite": "^4.1.0", + "mobx-utils": "^6.1.0", "parse-filepath": "^1.0.2", "patch-package": "^8.0.1", "postinstall-postinstall": "^2.1.0", diff --git a/src/app/promisedComputed.js b/src/app/promisedComputed.js new file mode 100644 index 00000000..20d3506c --- /dev/null +++ b/src/app/promisedComputed.js @@ -0,0 +1,59 @@ +import { computed, makeObservable, _getGlobalState } from 'mobx'; +import { fromPromise, isPromiseBasedObservable } from 'mobx-utils'; + +const ok = ( value ) => ( { ok: true, value } ); +const failed = ( error ) => ( { ok: false, error } ); + +// Replaces computed-async-mobx: its 7.0 build mixes decorators with annotations, which MobX 6 rejects. +// Like a computed that unwraps a promise: `init` until the first resolve, then the latest resolved value. +// `get` must run inside a reaction; `busy` is true while the promise is pending. +class PromisedComputed { + constructor( init, fetch ) { + this.fetch = fetch; + this.cached = ok( init ); + makeObservable( this, { + currentState: computed, + busy: computed, + value: computed, + } ); + } + + get currentState() { + try { + const promiseOrValue = this.fetch(); + return typeof promiseOrValue?.then === 'function' + ? fromPromise( promiseOrValue.then( ok, failed ) ) + : ok( promiseOrValue ); + } catch ( err ) { + return failed( err ); + } + } + + get busy() { + const state = this.currentState; + return isPromiseBasedObservable( state ) && state.state === 'pending'; + } + + get value() { + const state = this.currentState; + const result = !isPromiseBasedObservable( state ) + ? state + : state.state === 'fulfilled' + ? state.value + : this.cached; + this.cached = result; + if ( result.ok ) { + return result.value; + } + throw result.error; + } + + get() { + if ( !_getGlobalState().trackingDerivation ) { + throw new Error( 'promisedComputed must be used inside reactions' ); + } + return this.value; + } +} + +export const promisedComputed = ( init, fetch ) => new PromisedComputed( init, fetch ); diff --git a/src/app/store/Alignment.js b/src/app/store/Alignment.js index ec3343cf..59c2cc83 100644 --- a/src/app/store/Alignment.js +++ b/src/app/store/Alignment.js @@ -1,4 +1,4 @@ -import { observable, computed, action, runInAction } from 'mobx'; +import { observable, computed, action, runInAction, makeObservable } from 'mobx'; import * as raxmlSettings from '../../settings/raxml'; import * as raxmlNgSettings from '../../settings/raxmlng'; @@ -23,6 +23,7 @@ const raxmlNgModelOptions = raxmlNgSettings.modelOptions; class Alignment extends InputFile { constructor( run, path ) { super( run, path ); + makeObservable( this ); this.substitutionModel = new RaxmlNgAlignmentSubstitutionModel( this ); this.multistateNumber = new MultistateNumber( this ); this.ngStationaryFrequencies = new RaxmlNgModelF( this ); @@ -379,12 +380,12 @@ class Alignment extends InputFile { }; @action - dispose = () => { - this.unlisten(); - if ( this.modeltestLoading ) { - this.cancelModelTest(); - } - }; + dispose() { + this.unlisten(); + if ( this.modeltestLoading ) { + this.cancelModelTest(); + } + } @action remove = () => { diff --git a/src/app/store/AlignmentOptions.js b/src/app/store/AlignmentOptions.js index 9019fb6b..0a9d5feb 100644 --- a/src/app/store/AlignmentOptions.js +++ b/src/app/store/AlignmentOptions.js @@ -1,4 +1,4 @@ -import { computed } from 'mobx'; +import { computed, makeObservable, override } from 'mobx'; import Option from './Option'; import * as raxmlNgSettings from '../../settings/raxmlng'; @@ -8,6 +8,7 @@ const raxmlNgModelOptions = raxmlNgSettings.modelOptions; class RaxmlNgAlignmentSubstitutionModel extends Option { constructor( alignment ) { super( alignment.run, '', 'Substitution model' ); + makeObservable( this ); this.alignment = alignment; } @computed get options() { @@ -37,6 +38,7 @@ class RaxmlNgModelExtraParam extends Option { super( alignment.run, addNone ? '' : options[0].value, label ); + makeObservable( this ); this.alignment = alignment; this.optionsSource = addNone ? [{ value: '', title: 'none' }, ...options] @@ -106,8 +108,9 @@ class RaxmlNgModelASC extends RaxmlNgModelExtraParam { ].map( ( { value, label: title } ) => ( { value, title } ) ), { addNone: false }, ); + makeObservable( this ); } - @computed get notAvailable() { + @override get notAvailable() { return ( !this.run.haveAlignments || !this.run.usesRaxmlNg || @@ -119,6 +122,7 @@ class RaxmlNgModelASC extends RaxmlNgModelExtraParam { class MultistateNumber extends Option { constructor( alignment ) { super( alignment.run, '', 'Number of states' ); + makeObservable( this ); this.alignment = alignment; this.placeholder = 'Integer'; } @@ -128,7 +132,7 @@ class MultistateNumber extends Option { !this.alignment.run.usesRaxmlNg ); } - @computed get error() { + @override get error() { return !this.value || !Number.isInteger( Number( this.value ) ); } } diff --git a/src/app/store/AppStore.js b/src/app/store/AppStore.js index e976b17e..e9e02ed5 100644 --- a/src/app/store/AppStore.js +++ b/src/app/store/AppStore.js @@ -1,9 +1,13 @@ -import { observable, action } from 'mobx'; +import { observable, action, makeObservable } from 'mobx'; import StoreBase from './StoreBase'; import Citation from './Citation'; import Config from './Config'; class AppStore extends StoreBase { + constructor() { + super(); + makeObservable( this ); + } citation = new Citation(); config = new Config(); diff --git a/src/app/store/AstralTree.js b/src/app/store/AstralTree.js index 2450c18b..1a0da00d 100644 --- a/src/app/store/AstralTree.js +++ b/src/app/store/AstralTree.js @@ -1,8 +1,12 @@ -import { action } from 'mobx'; +import { action, makeObservable } from 'mobx'; import InputFile from './InputFile'; class AstralTree extends InputFile { + constructor( ...args ) { + super( ...args ); + makeObservable( this ); + } @action remove = () => { this.run.removeAstralTree(); diff --git a/src/app/store/Citation.js b/src/app/store/Citation.js index 788b8ae4..9e025f69 100644 --- a/src/app/store/Citation.js +++ b/src/app/store/Citation.js @@ -1,6 +1,9 @@ -import { observable, action, computed } from 'mobx'; +import { observable, action, computed, makeObservable } from 'mobx'; export default class Citation { + constructor() { + makeObservable( this ); + } @observable visible = false; formats = [ diff --git a/src/app/store/Config.js b/src/app/store/Config.js index dda5676c..b3dcd924 100644 --- a/src/app/store/Config.js +++ b/src/app/store/Config.js @@ -1,9 +1,10 @@ -import { observable, action, runInAction } from 'mobx'; +import { observable, action, runInAction, makeObservable } from 'mobx'; import StoreBase, { runEvents } from './StoreBase'; export default class Config extends StoreBase { constructor() { super(); + makeObservable( this ); this.listen(); const { rendererBridge } = /** @type {any} */ ( window ); rendererBridge.getDarkMode().then( ( value ) => { diff --git a/src/app/store/FinalAlignment.js b/src/app/store/FinalAlignment.js index c8fbc33e..964c40a9 100644 --- a/src/app/store/FinalAlignment.js +++ b/src/app/store/FinalAlignment.js @@ -1,4 +1,4 @@ -import { observable, computed, action } from 'mobx'; +import { observable, computed, action, makeObservable } from 'mobx'; import union from 'lodash/union'; import intersection from 'lodash/intersection'; @@ -8,6 +8,7 @@ import { join } from '../paths'; class FinalAlignment { constructor( run ) { + makeObservable( this ); this.run = run; this.partition = new FinalPartition( run ); } diff --git a/src/app/store/FinalPartition.js b/src/app/store/FinalPartition.js index 87dcb1e5..60c0d439 100644 --- a/src/app/store/FinalPartition.js +++ b/src/app/store/FinalPartition.js @@ -1,7 +1,8 @@ -import { computed } from 'mobx'; +import { computed, makeObservable } from 'mobx'; class FinalPartition { constructor( run ) { + makeObservable( this ); this.run = run; } /* diff --git a/src/app/store/InputFile.js b/src/app/store/InputFile.js index 347634b0..a4613987 100644 --- a/src/app/store/InputFile.js +++ b/src/app/store/InputFile.js @@ -1,4 +1,4 @@ -import { observable, computed, action } from 'mobx'; +import { observable, computed, action, makeObservable } from 'mobx'; import { base, dir, name } from '../paths'; import StoreBase from './StoreBase'; @@ -8,6 +8,7 @@ class InputFile extends StoreBase { constructor( run, path ) { super(); + makeObservable( this ); this.run = run; this.path = path; } diff --git a/src/app/store/Option.js b/src/app/store/Option.js index a630252e..7d9d956a 100644 --- a/src/app/store/Option.js +++ b/src/app/store/Option.js @@ -1,4 +1,4 @@ -import { observable, computed, action } from 'mobx'; +import { observable, computed, action, makeObservable } from 'mobx'; import { mixed } from 'yup'; class Option { @@ -19,6 +19,7 @@ class Option { hoverInfo, { schema = undefined, allowOnlyValidChange = false, helperText = '' } = {}, ) { + makeObservable( this ); this.run = run; this.defaultValue = defaultValue; this.title = title; diff --git a/src/app/store/PartOptions.js b/src/app/store/PartOptions.js index 4f921908..778e8289 100644 --- a/src/app/store/PartOptions.js +++ b/src/app/store/PartOptions.js @@ -1,4 +1,4 @@ -import { computed } from 'mobx'; +import { computed, makeObservable } from 'mobx'; import Option from './Option'; import * as raxmlSettings from '../../settings/raxml'; import * as yup from 'yup'; @@ -29,6 +29,7 @@ class PartBase extends Option { helperText, }, ); + makeObservable( this ); this.part = part; } @computed get alignment() { @@ -42,6 +43,7 @@ class PartType extends PartBase { schema: yup.string(), allowOnlyValidChange: true, } ); + makeObservable( this ); } @computed get finalValue() { const { dataType, partitionType } = this.alignment; @@ -71,6 +73,7 @@ class PartAAType extends PartBase { schema: yup.string(), allowOnlyValidChange: true, } ); + makeObservable( this ); } options = raxmlSettings.aminoAcidSubstitutionMatrixOptions.options.map( ( value ) => ( { value, title: value } ), @@ -85,6 +88,7 @@ class PartName extends PartBase { schema: yup.string(), // TODO: Check that it is unique within partition allowOnlyValidChange: true, } ); + makeObservable( this ); } @computed get notAvailable() { return false; @@ -96,6 +100,7 @@ class PartStart extends PartBase { schema: yup.number(), allowOnlyValidChange: false, } ); + makeObservable( this ); this.disabled = true; } @computed get notAvailable() { @@ -122,6 +127,7 @@ class PartEnd extends PartBase { allowOnlyValidChange: false, }, ); + makeObservable( this ); } @computed get min() { return ( @@ -144,6 +150,7 @@ class PartCodon extends PartBase { schema: yup.string(), allowOnlyValidChange: true, } ); + makeObservable( this ); } options = CodonModels.map( ( value ) => ( { value, title: value } ) ); @computed get notAvailable() { diff --git a/src/app/store/Partition.js b/src/app/store/Partition.js index b8270f2a..63779450 100644 --- a/src/app/store/Partition.js +++ b/src/app/store/Partition.js @@ -1,4 +1,4 @@ -import { observable, computed, action, reaction } from 'mobx'; +import { observable, computed, action, reaction, makeObservable } from 'mobx'; import { CODON_NONE, CODON_SPECIFIC, @@ -30,6 +30,7 @@ const getPartitionType = ( dataType, aaMatrixName = 'BLOSUM62' ) => { class Part { constructor( partition, { type, aaType, name, start, end, codon } ) { + makeObservable( this ); this.partition = partition; this.type = new PartType( this, type ); this.aaType = new PartAAType( this, aaType ); @@ -108,6 +109,7 @@ class Part { } class Partition { constructor( alignment ) { + makeObservable( this ); this.alignment = alignment; this.defaultPartition = new Part( this, { type: alignment.partitionType, @@ -127,7 +129,7 @@ class Partition { } ); reaction( () => alignment.length, - ( length, reaction ) => { + ( length, _previous, reaction ) => { reaction.dispose(); // Make default alignment complete except for mixed type if ( this.alignment.dataType !== 'mixed' ) { diff --git a/src/app/store/Run.js b/src/app/store/Run.js index a462ca29..2d630678 100644 --- a/src/app/store/Run.js +++ b/src/app/store/Run.js @@ -1,5 +1,5 @@ -import { observable, computed, action, runInAction, createAtom } from 'mobx'; -import { promisedComputed } from 'computed-async-mobx'; +import { observable, computed, action, runInAction, createAtom, makeObservable } from 'mobx'; +import { promisedComputed } from '../promisedComputed'; import filenamify from 'filenamify'; import Alignment from './Alignment'; @@ -44,6 +44,7 @@ const { windows } = host; class Run extends StoreBase { constructor( parent, id ) { super(); + makeObservable( this ); this.parent = parent; this.id = id; this.finalAlignment = new FinalAlignment( this ); diff --git a/src/app/store/RunList.js b/src/app/store/RunList.js index 10156ecd..27f3fff8 100644 --- a/src/app/store/RunList.js +++ b/src/app/store/RunList.js @@ -1,4 +1,4 @@ -import { observable, computed, action } from 'mobx'; +import { observable, computed, action, makeObservable } from 'mobx'; import Run from './Run'; import AppStore from './AppStore'; import { runEvents } from './StoreBase'; @@ -9,6 +9,7 @@ class RunList extends AppStore { constructor() { super(); + makeObservable( this ); this.addRun(); this.listen(); } diff --git a/src/app/store/RunOptions.js b/src/app/store/RunOptions.js index 13def9fb..af935638 100644 --- a/src/app/store/RunOptions.js +++ b/src/app/store/RunOptions.js @@ -1,4 +1,4 @@ -import { observable, computed, action } from 'mobx'; +import { observable, computed, action, makeObservable, override } from 'mobx'; import { range } from 'd3-array'; import Option from './Option'; @@ -263,6 +263,7 @@ export const raxmlNgAnalysisOptions = [ export class Binary extends Option { constructor( run ) { super( run, initialBinaryName, 'Binary', 'Name of binary' ); + makeObservable( this ); } options = binaries.map( ( { name } ) => ( { value: name, title: name } ) ); @computed get version() { @@ -276,6 +277,7 @@ export class Binary extends Option { export class NumThreads extends Option { constructor( run ) { super( run, 2, 'Threads', 'Number of cpu threads' ); + makeObservable( this ); } options = range( 1, MAX_NUM_CPUS + 1 ).map( ( value ) => ( { value, @@ -308,6 +310,7 @@ export class RaxmlNgAnalysis extends Option { export class NumRuns extends Option { constructor( run ) { super( run, 1, 'Runs', 'Number of runs' ); + makeObservable( this ); } options = [1, 10, 20, 50, 100, 500].map( ( value ) => ( { value, title: value } ) ); @computed get notAvailable() { @@ -318,6 +321,7 @@ export class NumRuns extends Option { export class NumRepetitions extends Option { constructor( run ) { super( run, 100, 'Reps.', 'Number of repetitions' ); + makeObservable( this ); } options = [ 100, @@ -338,6 +342,7 @@ export class NumRepetitions extends Option { export class NumRepetitionsNg extends Option { constructor( run ) { super( run, 100, 'Reps.', 'Number of repetitions' ); + makeObservable( this ); } options = [100, 200, 500, 1000, 10000, 'autoMRE'].map( ( value ) => ( { value, @@ -358,6 +363,7 @@ export class BranchLength extends Option { 'Compute branch lengths', 'Optimize model parameters and branch lengths for the given input tree', ); + makeObservable( this ); } @computed get notAvailable() { return !this.run.analysisOption.params.includes( params.brL ); @@ -373,6 +379,7 @@ export class SHlike extends Option { 'Compute log-likelihood test', 'Shimodaira-Hasegawa-like procedure', ); + makeObservable( this ); } @computed get notAvailable() { return !this.run.analysisOption.params.includes( params.SHlike ); @@ -382,6 +389,7 @@ export class SHlike extends Option { export class CombinedOutput extends Option { constructor( run ) { super( run, false, 'Combined output', 'Concatenate output trees' ); + makeObservable( this ); } @computed get notAvailable() { return !this.run.analysisOption.params.includes( params.combinedOutput ); @@ -394,6 +402,7 @@ export class CombinedOutput extends Option { export class StartingTree extends Option { constructor( run ) { super( run, 'Maximum parsimony', 'Starting tree', '' ); + makeObservable( this ); } options = ['Maximum parsimony', 'User defined'].map( ( value ) => ( { value, @@ -407,6 +416,7 @@ export class StartingTree extends Option { export class OutGroup extends Option { constructor( run ) { super( run, [''], 'Outgroup', '' ); + makeObservable( this ); this.multiple = true; } @computed get options() { @@ -416,7 +426,7 @@ export class OutGroup extends Option { } ) ); } - @action setValue( value ) { + @override setValue( value ) { if ( this.value.includes( '' ) ) { this.value = value.filter( ( v ) => v !== '' ); return; @@ -444,6 +454,7 @@ export class OutGroup extends Option { export class SubstitutionMatrix extends Option { constructor( run ) { super( run, 'GTR', 'Substitution matrix' ); + makeObservable( this ); } @computed get options() { if ( !this.run.haveAlignments ) { @@ -504,6 +515,7 @@ export class SubstitutionMatrix extends Option { export class SubstitutionRate extends Option { constructor( run ) { super( run, 'GAMMA', 'Substitution rates' ); + makeObservable( this ); } @computed get options() { if ( !this.run.haveAlignments ) { @@ -539,6 +551,7 @@ export class SubstitutionRate extends Option { export class SubstitutionI extends Option { constructor( run ) { super( run, 'none', 'Proportion of invariant sites' ); + makeObservable( this ); } @computed get options() { if ( !this.run.haveAlignments ) { @@ -570,6 +583,7 @@ export class SubstitutionI extends Option { export class SubstitutionAscertainment extends Option { constructor( run ) { super( run, 'none', 'Ascertainment bias correction' ); + makeObservable( this ); } @computed get options() { if ( !this.run.haveAlignments ) { @@ -620,6 +634,7 @@ export class AAMatrixName extends Option { 'Matrix name', 'Amino Acid Substitution Matrix name', ); + makeObservable( this ); } options = raxmlSettings.aminoAcidSubstitutionMatrixOptions.options.map( ( value ) => ( { value, title: value } ), @@ -638,6 +653,7 @@ export class EstimatedFrequencies extends Option { 'Estimated base frequencies', 'Use estimated base frequencies instead of empirical.', ); + makeObservable( this ); } @computed get notAvailable() { return this.run.dataType === 'protein' || this.run.usesRaxmlNg; @@ -652,6 +668,7 @@ export class BaseFrequencies extends Option { 'Base frequencies', 'Empirical, ML estimated or model based base frequencies', ); + makeObservable( this ); } options = [ { title: 'From model', value: 'default' }, @@ -666,6 +683,7 @@ export class BaseFrequencies extends Option { export class MultistateModel extends Option { constructor( run ) { super( run, 'GTR', 'Multistate model' ); + makeObservable( this ); } options = raxmlSettings.kMultistateSubstitutionModelOptions.options.map( ( value ) => ( { value, title: value } ), @@ -678,6 +696,7 @@ export class MultistateModel extends Option { class TreeFile extends Option { constructor( run ) { super( run, '', 'Tree', '' ); + makeObservable( this ); } @observable filePath = ''; @computed get haveFile() { @@ -709,6 +728,10 @@ class TreeFile extends Option { } export class Tree extends TreeFile { + constructor( ...args ) { + super( ...args ); + makeObservable( this ); + } @computed get notAvailable() { return !( this.run.analysisOption.params.includes( params.tree ) || @@ -719,6 +742,10 @@ export class Tree extends TreeFile { } export class BackboneConstraintTree extends TreeFile { + constructor( ...args ) { + super( ...args ); + makeObservable( this ); + } @computed get isSet() { return this.run.useBackboneConstraint && this.haveFile; } @@ -743,6 +770,10 @@ export class BackboneConstraintTree extends TreeFile { } export class MultifurcatingConstraintTree extends TreeFile { + constructor( ...args ) { + super( ...args ); + makeObservable( this ); + } @computed get isSet() { return this.run.useMultifurcatingConstraint && this.haveFile; } diff --git a/src/app/store/StoreBase.js b/src/app/store/StoreBase.js index 6efcc320..86a80780 100644 --- a/src/app/store/StoreBase.js +++ b/src/app/store/StoreBase.js @@ -35,9 +35,10 @@ export default class StoreBase { } }; - dispose = () => { + // A method: a field here would clash with a subclass's decorated dispose. + dispose() { this.unlisten(); - }; + } _init = () => { const { rendererBridge } = /** @type {any} */ ( window ); diff --git a/tsconfig.json b/tsconfig.json index 61517d59..534a7d41 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,7 @@ "module": "ESNext", "moduleResolution": "bundler", "experimentalDecorators": true, - "useDefineForClassFields": false, + "useDefineForClassFields": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": false, diff --git a/yarn.lock b/yarn.lock index f8d388a7..cf3d3019 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4523,11 +4523,6 @@ compare-version@^0.1.2: resolved "https://registry.yarnpkg.com/compare-version/-/compare-version-0.1.2.tgz#0162ec2d9351f5ddd59a9202cba935366a725080" integrity sha512-pJDh5/4wrEnXX/VWRZvruAGHkzKdr46z11OlTPN+VrATlWWhSKewNCJ1futCO5C7eJB3nPMFZA1LeYtcFboZ2A== -computed-async-mobx@^4.2.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/computed-async-mobx/-/computed-async-mobx-4.2.1.tgz#868c899f209af0bcdecaf677abd9bb50f9f39105" - integrity sha512-kThbGHul+3YrXWFfxRJpuHAv9CdEl/UVGI79BmMq3m6UMuWggZq3Hyp2tj1hEe3ZScokTzg+Quxk7X5cN3YKpA== - concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -7940,20 +7935,22 @@ mkdirp@^1.0.3: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -mobx-react-lite@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/mobx-react-lite/-/mobx-react-lite-2.2.2.tgz#87c217dc72b4e47b22493daf155daf3759f868a6" - integrity sha512-2SlXALHIkyUPDsV4VTKVR9DW7K3Ksh1aaIv3NrNJygTbhXe2A9GrcKHZ2ovIiOp/BXilOcTYemfHHZubP431dg== +mobx-react-lite@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/mobx-react-lite/-/mobx-react-lite-4.1.1.tgz#725d74b025235f73dc2ab815766ffe010be2cf8a" + integrity sha512-iUxiMpsvNraCKXU+yPotsOncNNmyeS2B5DKL+TL6Tar/xm+wwNJAubJmtRSeAoYawdZqwv8Z/+5nPRHeQxTiXg== + dependencies: + use-sync-external-store "^1.4.0" -mobx-utils@^5.6.2: - version "5.6.2" - resolved "https://registry.yarnpkg.com/mobx-utils/-/mobx-utils-5.6.2.tgz#4858acbdb03f0470e260854f87e8c2ba916ebaec" - integrity sha512-a/WlXyGkp6F12b01sTarENpxbmlRgPHFyR1Xv2bsSjQBm5dcOtd16ONb40/vOqck8L99NHpI+C9MXQ+SZ8f+yw== +mobx-utils@^6.1.0: + version "6.1.1" + resolved "https://registry.yarnpkg.com/mobx-utils/-/mobx-utils-6.1.1.tgz#61c66563e7646fb75462c189f4110a76d2e35768" + integrity sha512-ZR4tOKucWAHOdMjqElRl2BEvrzK7duuDdKmsbEbt2kzgVpuLuoYLiDCjc3QwWQl8CmOlxPgaZQpZ7emwNqPkIg== -mobx@^5.15.7: - version "5.15.7" - resolved "https://registry.yarnpkg.com/mobx/-/mobx-5.15.7.tgz#b9a5f2b6251f5d96980d13c78e9b5d8d4ce22665" - integrity sha512-wyM3FghTkhmC+hQjyPGGFdpehrcX1KOXsDuERhfK2YbJemkUhEB+6wzEN639T21onxlfYBmriA1PFnvxTUhcKw== +mobx@^6.16.0: + version "6.16.1" + resolved "https://registry.yarnpkg.com/mobx/-/mobx-6.16.1.tgz#8b3166186d1298b1848395e10e64b5c43d6dc43b" + integrity sha512-syNcDdX3KT+Jq3je6eGjBhuc24Z68td2VG0zNFqRswaE433D9SNH5VRy/xrGbJsUixfppLLccXhAW9JSf6n+SQ== ms@2.0.0: version "2.0.0" @@ -10051,6 +10048,11 @@ url-to-options@^1.0.1: resolved "https://registry.yarnpkg.com/url-to-options/-/url-to-options-1.0.1.tgz#1505a03a289a48cbd7a434efbaeec5055f5633a9" integrity sha512-0kQLIzG4fdk/G5NONku64rSH/x32NOA39LVQqlK8Le6lvTF6GGRJpqaQFGgU+CLwySIqBSMdwYM0sYcW9f6P4A== +use-sync-external-store@^1.4.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz#6dcb66ef569e02f186af6b3d575f414ce746e18f" + integrity sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A== + usehooks-ts@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/usehooks-ts/-/usehooks-ts-3.1.1.tgz#0bb7f38f36f8219ee4509cc5e944ae610fb97656" From c637d754fcf1fd6408144021a5ce51f0d4221ad3 Mon Sep 17 00:00:00 2001 From: Johannes Klein Agents Date: Sun, 15 Nov 2026 22:44:48 +0100 Subject: [PATCH 2/3] Drop stale App.test.js typecheck baseline entries The Jest types commit resolved them, so typecheck:baseline exited 1 on unused baseline lines. Co-Authored-By: Claude Sonnet 5.5 --- scripts/typecheck-baseline.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/typecheck-baseline.txt b/scripts/typecheck-baseline.txt index ce174476..3743f8e4 100644 --- a/scripts/typecheck-baseline.txt +++ b/scripts/typecheck-baseline.txt @@ -6,8 +6,6 @@ src/app/App.js(322,24): error TS2769: No overload matches this call. Property 'title' does not exist on type 'IntrinsicAttributes & SvgIconOwnProps & CommonProps & Omit, "fontSize" | ... 10 more ... | "titleAccess">'. src/app/App.js(466,12): error TS2739: Type '{ error: any; onClose: any; }' is missing the following properties from type '{ error: any; onClose: any; needReload: any; title: any; }': needReload, title src/app/App.js(512,10): error TS2741: Property 'needReload' is missing in type '{ error: any; title: any; onClose: () => void; }' but required in type '{ error: any; onClose: any; needReload: any; title: any; }'. -src/app/App.test.js(5,1): error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. -src/app/App.test.js(13,3): error TS2304: Cannot find name 'expect'. src/app/store/AlignmentOptions.js(10,5): error TS2554: Expected 5-6 arguments, but got 3. src/app/store/AlignmentOptions.js(37,5): error TS2554: Expected 5-6 arguments, but got 3. src/app/store/AlignmentOptions.js(121,5): error TS2554: Expected 5-6 arguments, but got 3. From e996b957bc07b626d7872a888636569c41559412 Mon Sep 17 00:00:00 2001 From: Johannes Klein Agents Date: Sun, 15 Nov 2026 23:02:15 +0100 Subject: [PATCH 3/3] Restore App.test.js typecheck baseline entries The spec branch lacks the Jest types, so CI still reports them; the local node_modules came from master and hid them. Co-Authored-By: Claude Sonnet 5.5 --- scripts/typecheck-baseline.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/typecheck-baseline.txt b/scripts/typecheck-baseline.txt index 3743f8e4..ce174476 100644 --- a/scripts/typecheck-baseline.txt +++ b/scripts/typecheck-baseline.txt @@ -6,6 +6,8 @@ src/app/App.js(322,24): error TS2769: No overload matches this call. Property 'title' does not exist on type 'IntrinsicAttributes & SvgIconOwnProps & CommonProps & Omit, "fontSize" | ... 10 more ... | "titleAccess">'. src/app/App.js(466,12): error TS2739: Type '{ error: any; onClose: any; }' is missing the following properties from type '{ error: any; onClose: any; needReload: any; title: any; }': needReload, title src/app/App.js(512,10): error TS2741: Property 'needReload' is missing in type '{ error: any; title: any; onClose: () => void; }' but required in type '{ error: any; onClose: any; needReload: any; title: any; }'. +src/app/App.test.js(5,1): error TS2582: Cannot find name 'it'. Do you need to install type definitions for a test runner? Try `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`. +src/app/App.test.js(13,3): error TS2304: Cannot find name 'expect'. src/app/store/AlignmentOptions.js(10,5): error TS2554: Expected 5-6 arguments, but got 3. src/app/store/AlignmentOptions.js(37,5): error TS2554: Expected 5-6 arguments, but got 3. src/app/store/AlignmentOptions.js(121,5): error TS2554: Expected 5-6 arguments, but got 3.