Skip to content

Commit

Permalink
fix(upload-ctx-provider): execute destroy context callback async to e…
Browse files Browse the repository at this point in the history
…nsure all sync callbacks are run
  • Loading branch information
nd0ut committed Dec 19, 2023
1 parent b6eca31 commit a4bbdd0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 4 additions & 1 deletion abstract/Block.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ export class Block extends BaseComponent {
Data.deleteCtx(this);

if (blocksRegistry.size === 0) {
this.destroyCtxCallback();
setTimeout(() => {
// Destroy global context after all blocks are destroyed and all callbacks are run
this.destroyCtxCallback();
}, 0);
}
}

Expand Down
4 changes: 0 additions & 4 deletions abstract/UploaderBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ export class UploaderBlock extends ActivityBlock {
}
}

destroyCallback() {
super.destroyCallback();
}

destroyCtxCallback() {
this._unobserveCollectionProperties?.();
this._unobserveCollection?.();
Expand Down

0 comments on commit a4bbdd0

Please sign in to comment.