Skip to content

Commit

Permalink
fix useless warning when loading the site data, use grapesjs-notifica…
Browse files Browse the repository at this point in the history
…tions plugin
  • Loading branch information
lexoyo committed Apr 24, 2024
1 parent 0591646 commit 8b17008
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/model/Symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,21 @@ export class Symbols extends Backbone.Collection<Symbol> {
symbol.addInstance(c)
}
} else {
console.warn('Could not add instance', c, `Could not find the symbol with id ${symbolId} (maybe later?)`)
// The symbol is not yet loaded
setTimeout(() => {
// Check again
if(this.get(symbolId)) {
// Allright in the end, it was just during loading
} else {
console.error(`Could not make component with id \`${c.getId()}\` an instance of symbol with id \`${symbolId}\`: symbol not found`)
this.editor.runCommand('notifications:add', {
type: 'error',
group: 'Symbols errors',
message: `There is a problem with this component: it is supposed to be an instance of a symbol, but the symbol is not found. Symbol id: ${symbolId}`,
componentId: c.getId(),
})
}
})
}
}
}
Expand Down

0 comments on commit 8b17008

Please sign in to comment.