-
Notifications
You must be signed in to change notification settings - Fork 277
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
fix: menus are not unregistered upon extension deactivation #2188
Conversation
Fixes containers#2069 Signed-off-by: Jeff MAURY <jmaury@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
my only concern is that we should add some rule to avoid duplicate commands. I think it's possible that two extensions contribute to the same menu with two command having the same name. In that case one will overwrite the other.
BTW this fixes our current issue, this is why i gave my LGTM, not sure if you want to fix this other thing in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I have the same concern as @lstocchi regarding adding logic regarding adding multiple same-named menus.
|
||
const analyzedExtension = this.analyzedExtensions.get(extensionId); | ||
if (analyzedExtension) { | ||
const extensionConfiguration = analyzedExtension.manifest?.contributes?.configuration; | ||
if (extensionConfiguration) { | ||
this.configurationRegistry.deregisterConfigurations([extensionConfiguration]); | ||
} | ||
const menus = analyzedExtension.manifest?.contributes?.menus; | ||
if (menus) { | ||
this.menuRegistry.unregisterMenus(menus); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably need to move this upper before we delete it from activated extensions ?
Signed-off-by: Jeff MAURY <jmaury@redhat.com>
Fixes #2069
What does this PR do?
Unregister contributed menus when extension is stopped
Screenshot/screencast of this PR
What issues does this PR fix or reference?
Fixes #2069
How to test this PR?
Stop and start Kind extension and make sure the Push to cluster menu appears only once on the Images tab