From 6e845d97132db1a4f72bf33d2621d01851f9ced1 Mon Sep 17 00:00:00 2001 From: Dario Gieselaar Date: Tue, 14 Jan 2020 10:52:03 +0100 Subject: [PATCH] [APM]: Fix render error when license has not been loaded --- .../plugins/apm/public/context/LicenseContext/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x-pack/legacy/plugins/apm/public/context/LicenseContext/index.tsx b/x-pack/legacy/plugins/apm/public/context/LicenseContext/index.tsx index 0bd3896782603..62cdbd3bbc995 100644 --- a/x-pack/legacy/plugins/apm/public/context/LicenseContext/index.tsx +++ b/x-pack/legacy/plugins/apm/public/context/LicenseContext/index.tsx @@ -16,8 +16,9 @@ export const LicenseContext = React.createContext( export function LicenseProvider({ children }: { children: React.ReactChild }) { const { license$ } = useApmPluginContext().plugins.licensing; - const license = useObservable(license$, { isActive: true } as ILicense); - const hasInvalidLicense = !license.isActive; + const license = useObservable(license$); + // if license is not loaded yet, consider it valid + const hasInvalidLicense = license?.isActive === false; // if license is invalid show an error message if (hasInvalidLicense) {