Skip to content

Commit

Permalink
Enable Watcher by default to fix bug in which Watcher doesn't render …
Browse files Browse the repository at this point in the history
…in the side nav (elastic#68602)
  • Loading branch information
cjcenizal committed Jun 9, 2020
1 parent b2d069f commit 1a91965
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions x-pack/plugins/watcher/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ export class WatcherUIPlugin implements Plugin<void, void, Dependencies, any> {
},
});

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
Expand All @@ -81,9 +79,16 @@ export class WatcherUIPlugin implements Plugin<void, void, Dependencies, any> {
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();
}
});
}
Expand Down

0 comments on commit 1a91965

Please sign in to comment.