Skip to content

Commit

Permalink
fix: warn when malloy-render already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
skokenes committed Jul 19, 2024
1 parent 20051b5 commit 9109cb6
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions packages/malloy-render/src/component/render-webcomponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ const withStyles = ComponentType => {
};
};

compose(
register('malloy-render', {
result: undefined,
queryResult: undefined,
modelDef: undefined,
}),
withStyles,
withSolid
)(MalloyRender);
if (!customElements.get('malloy-render')) {
compose(
register('malloy-render', {
result: undefined,
queryResult: undefined,
modelDef: undefined,
}),
withStyles,
withSolid
)(MalloyRender);
} else {
console.warn(
"The custom element 'malloy-render' has already been defined. Make sure you are not loading multiple versions of the malloy-render package as they could conflict."
);
}

declare global {
interface HTMLElementTagNameMap {
Expand Down

0 comments on commit 9109cb6

Please sign in to comment.