Skip to content
Snippets Groups Projects
Commit afb6c65c authored by Alexander Rose's avatar Alexander Rose
Browse files

fix sequence widget update on state changes

parent 527e91c9
Branches
Tags
No related merge requests found
......@@ -148,17 +148,13 @@ export class SequenceView extends PluginUIComponent<{ }, SequenceViewState> {
this.subscribe(this.plugin.events.state.object.updated, ({ ref, obj }) => {
if (ref === this.state.structureRef && obj && obj.type === PSO.Molecule.Structure.type && obj.data !== this.state.structure) {
this.forceUpdate()
this.setState(this.getInitialState())
}
});
this.subscribe(this.plugin.events.state.object.created, ({ obj }) => {
if (obj && obj.type === PSO.Molecule.Structure.type) {
if (this.state.structure.isEmpty) {
this.setState(this.getInitialState())
} else {
this.forceUpdate()
}
this.setState(this.getInitialState())
}
});
......@@ -181,6 +177,7 @@ export class SequenceView extends PluginUIComponent<{ }, SequenceViewState> {
}
private getInitialState(): SequenceViewState {
// TODO reuse selected values from previous state if applicable
const structureRef = getStructureOptions(this.plugin.state.dataState)[0][0]
const structure = this.getStructure(structureRef)
const entityId = getEntityOptions(structure)[0][0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment