File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
packages/compass-data-modeling/src/store Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -27,10 +27,12 @@ export type DataModelingStoreServices = {
2727export function activateDataModelingStore (
2828 { openToast = _openToast } : DataModelingStoreOptions ,
2929 services : DataModelingStoreServices ,
30- { cleanup } : ActivateHelpers
30+ { cleanup, addCleanup } : ActivateHelpers
3131) {
32- const cancelAnalysisControllerRef = { current : null } ;
33- const cancelExportControllerRef = { current : null } ;
32+ const cancelAnalysisControllerRef : DataModelingExtraArgs [ 'cancelAnalysisControllerRef' ] =
33+ { current : null } ;
34+ const cancelExportControllerRef : DataModelingExtraArgs [ 'cancelExportControllerRef' ] =
35+ { current : null } ;
3436 const store = createStore (
3537 reducer ,
3638 applyMiddleware (
@@ -42,5 +44,12 @@ export function activateDataModelingStore(
4244 } )
4345 )
4446 ) ;
47+
48+ addCleanup ( ( ) => {
49+ // Abort any ongoing analysis and exporting when deactivated.
50+ cancelAnalysisControllerRef . current ?. abort ( ) ;
51+ cancelExportControllerRef . current ?. abort ( ) ;
52+ } ) ;
53+
4554 return { store, deactivate : cleanup } ;
4655}
You can’t perform that action at this time.
0 commit comments