Skip to content

Commit

Permalink
should register component to application if component definition prov…
Browse files Browse the repository at this point in the history
…ided
  • Loading branch information
roncodes committed Feb 6, 2024
1 parent 2499869 commit f2a3387
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion addon/services/universe.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,19 @@ export default class UniverseService extends Service.extend(Evented) {
*/
_createDashboardWidget(widget) {
// Extract properties from the widget object
const { did, name, description, icon, component, grid_options, options } = widget;
let { did, name, description, icon, component, grid_options, options } = widget;

// If component is a definition register to host application
if (typeof component === 'function') {
const owner = getOwner(this);

if (owner) {
owner.register(`component:${component.name}`, component);

// Update component name
component = component.name;
}
}

// Create a new widget object with the extracted properties
const newWidget = {
Expand Down

0 comments on commit f2a3387

Please sign in to comment.