Skip to content

Commit

Permalink
fix(block): correctly destroy nullish blocks registrey on destroy cal…
Browse files Browse the repository at this point in the history
…lback
  • Loading branch information
nd0ut committed Jun 27, 2024
1 parent 21b0ec2 commit a573ce1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions abstract/Block.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class Block extends BaseComponent {
/** @protected */
destroyCallback() {
let blocksRegistry = this.blocksRegistry;
blocksRegistry.delete(this);
blocksRegistry?.delete(this);

this.localeManager?.destroyL10nBindings(this);
this.l10nProcessorSubs = new Map();
Expand All @@ -219,7 +219,7 @@ export class Block extends BaseComponent {
// TODO: this should be done inside symbiote
Data.deleteCtx(this);

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

0 comments on commit a573ce1

Please sign in to comment.