Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Watcher by default to fix bug in which Watcher doesn't render in the side nav #68602

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -64,8 +64,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 @@ -85,9 +83,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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this line now too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops sorry, I hit merge before I saw this comment! You're right, that line isn't necessary. Let's remove it in a subsequent PR, or perhaps leave it if we refactor this code to consume all events in the stream and not just the first one.

watcherHome.showOnHomePage = true;
} else {
watcherESApp.disable();
}
});
}
Expand Down