From b603c36082b3588b80e8dac81ea020f1a67a3566 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Tue, 9 Jun 2020 14:00:31 -0700 Subject: [PATCH] Enable Watcher by default to fix bug in which Watcher doesn't render in the side nav (#68602) (#68691) --- x-pack/plugins/watcher/public/plugin.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/watcher/public/plugin.ts b/x-pack/plugins/watcher/public/plugin.ts index 6de21bc27d48c..f5cbfaee96cf5 100644 --- a/x-pack/plugins/watcher/public/plugin.ts +++ b/x-pack/plugins/watcher/public/plugin.ts @@ -60,8 +60,6 @@ export class WatcherUIPlugin implements Plugin { }, }); - watcherESApp.disable(); - // TODO: Fix the below dependency on `home` plugin inner workings // Because the home feature catalogue does not have enable/disable functionality we pass // the config in but keep a reference for enabling and disabling showing on home based on @@ -81,9 +79,16 @@ export class WatcherUIPlugin implements Plugin { home.featureCatalogue.register(watcherHome); licensing.license$.pipe(first(), map(licenseToLicenseStatus)).subscribe(({ valid }) => { + // NOTE: We enable the plugin by default instead of disabling it by default because this + // creates a race condition that can cause the app nav item to not render in the side nav. + // The race condition still exists, but it will result in the item rendering when it shouldn't + // (e.g. on a license it's not available for), instead of *not* rendering when it *should*, + // which is a less frustrating UX. if (valid) { watcherESApp.enable(); watcherHome.showOnHomePage = true; + } else { + watcherESApp.disable(); } }); }