From 4e32b7a78579e793781d47fe9491755ceb6da93c Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:18:24 +0100 Subject: [PATCH] make the cache private --- .../global-contexts/document-configuration.context.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/global-contexts/document-configuration.context.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/global-contexts/document-configuration.context.ts index a5644b0cfc..3cb6897a37 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/global-contexts/document-configuration.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/global-contexts/document-configuration.context.ts @@ -12,7 +12,10 @@ import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources'; * A context for fetching and caching the document configuration. */ export class UmbDocumentConfigurationContext extends UmbControllerBase implements UmbApi { - static DocumentConfiguration: Promise; + /** + * The cached document configuration. + */ + static #DocumentConfiguration: Promise; constructor(host: UmbControllerHost) { super(host); @@ -24,8 +27,7 @@ export class UmbDocumentConfigurationContext extends UmbControllerBase implement * @returns A promise that resolves to the document configuration, or null if the configuration could not be fetched. */ getDocumentConfiguration(): Promise { - debugger; - return (UmbDocumentConfigurationContext.DocumentConfiguration ??= this.fetchDocumentConfiguration()); + return (UmbDocumentConfigurationContext.#DocumentConfiguration ??= this.fetchDocumentConfiguration()); } /** @@ -39,6 +41,7 @@ export class UmbDocumentConfigurationContext extends UmbControllerBase implement } } +// Export as default to work as a global context: export default UmbDocumentConfigurationContext; export const UMB_DOCUMENT_CONFIGURATION_CONTEXT = new UmbContextToken(