diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/debug/debug.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/debug/debug.element.ts index ad695d592a..3648a424bb 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/debug/debug.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/debug/debug.element.ts @@ -110,30 +110,32 @@ export class UmbDebug extends LitElement { private _renderInstance(instance: any) { const instanceKeys: TemplateResult[] = []; - if (typeof instance !== 'object') { - return instanceKeys; - } - - const methodNames = this.getClassMethodNames(instance); - if (methodNames.length) { - instanceKeys.push(html`
  • Methods - ${methodNames.join(', ')}
  • `); - } - - for (const key in instance) { - if (key.startsWith('_')) { - continue; + if (typeof instance === 'function') { + return instanceKeys.push(html`
  • Callable Function
  • `); + } else if (typeof instance === 'object') { + const methodNames = this.getClassMethodNames(instance); + if (methodNames.length) { + instanceKeys.push(html`
  • Methods - ${methodNames.join(', ')}
  • `); } - // Goes KABOOM - if try to loop over the class/object - // instanceKeys.push(html`
  • ${key} = ${instance[key]}
  • `); - // console.log(`key: ${key} = ${value} TYPEOF: ${typeof value}`); + for (const key in instance) { + if (key.startsWith('_')) { + continue; + } + // Goes KABOOM - if try to loop over the class/object + // instanceKeys.push(html`
  • ${key} = ${instance[key]}
  • `); - const value = instance[key]; - if (typeof value === 'string') { - instanceKeys.push(html`
  • ${key} = ${value}
  • `); - } else { - instanceKeys.push(html`
  • ${key} (${typeof value})
  • `); + // console.log(`key: ${key} = ${value} TYPEOF: ${typeof value}`); + + const value = instance[key]; + if (typeof value === 'string') { + instanceKeys.push(html`
  • ${key} = ${value}
  • `); + } else { + instanceKeys.push(html`
  • ${key} (${typeof value})
  • `); + } } + } else { + instanceKeys.push(html`
  • Context is a primitive with value: ${instance}
  • `); } return instanceKeys;