Skip to content

Commit

Permalink
fix(AbstractWidgetFactory): Incorrect unsubscribe logic
Browse files Browse the repository at this point in the history
  • Loading branch information
floryst committed Oct 28, 2019
1 parent 676023a commit ab83119
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Widgets/Core/AbstractWidgetFactory/index.js
Expand Up @@ -153,13 +153,13 @@ function vtkAbstractWidgetFactory(publicAPI, model) {
// Event Widget API
// --------------------------------------------------------------------------
let unsubscribe = NoOp;
publicAPI.delete = macro.chain(publicAPI.delete, unsubscribe);
publicAPI.delete = macro.chain(publicAPI.delete, () => unsubscribe());

// Defer after object instantiation so model.widgetState actually exist
setTimeout(() => {
unsubscribe = model.widgetState.onModified(() =>
publicAPI.invokeWidgetChange(model.widgetState)
);
).unsubscribe;
}, 0);
}

Expand Down

0 comments on commit ab83119

Please sign in to comment.