From f2a3387c3645f6f5d1b3ed571aa97e786d93e7ee Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Tue, 6 Feb 2024 19:22:00 +0800 Subject: [PATCH] should register component to application if component definition provided --- addon/services/universe.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/addon/services/universe.js b/addon/services/universe.js index e14cad0..5c04cde 100644 --- a/addon/services/universe.js +++ b/addon/services/universe.js @@ -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 = {