diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/code-editor/code-editor.controller.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/code-editor/code-editor.controller.ts index 3ce2e64817..f30c2e42a4 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/code-editor/code-editor.controller.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/code-editor/code-editor.controller.ts @@ -97,9 +97,9 @@ export class UmbCodeEditorController { set value(newValue: string) { if (!this.#editor) throw new Error('Editor object not found'); - const oldValue = this.value; + const oldValue = this.value ?? ''; if (newValue !== oldValue) { - this.#editor.setValue(newValue); + this.#editor.setValue(newValue ?? ''); } } /**