[APM]: Fix render error when license has not been loaded (#54718)

This commit is contained in:
Dario Gieselaar 2020-01-14 18:57:21 +01:00 committed by GitHub
parent 46b34db465
commit 8d57df0fe6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,8 +16,9 @@ export const LicenseContext = React.createContext<ILicense | undefined>(
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) {