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

Remove extension when folder is removed during runtime #1518

Merged
merged 1 commit into from Nov 26, 2020

Conversation

panuhorsmalahti
Copy link
Contributor

  • prettier is added only to support inline snapshots
  • If user has extension page open and the extension folder is deleted, "Page not found" 'error' will be displayed. We could redirect to a working page. I'll add issue for this.

Fixes #1461

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
Comment on lines +71 to +80
if (instance) {
try {
instance.disable();
this.events.emit("remove", instance);
this.instances.delete(lensExtensionId);
} catch (error) {
logger.error(`${logModule}: deactivation extension error`, { lensExtensionId, error });
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think about the if (!instance) { return; } style instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see that being necessarily better, but fixed

if (!this.extensions.delete(lensExtensionId)) {
throw new Error(`Can't remove extension ${lensExtensionId}, doesn't exist.`);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

New line at the end of a function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines +11483 to +11487
prettier@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.0.tgz#8a03c7777883b29b37fb2c4348c66a78e980418b"
integrity sha512-yYerpkvseM4iKD/BXLYUkQV5aKt4tQPqaGW6EsZjzyu0r7sVZZNPJW4Y8MyKmicp6t42XUPcBVA+H6sB3gqndw==

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see any references to it in any of this diff. Are you sure you are actually using it for your intended purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was mentioned in the issue description, jest requires this dependency for inline snapshots: jestjs/jest#8467

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah I saw that comment, but I assumed that it would have to be explicitly "used" somewhere.

@jakolehm jakolehm added area/extension Something to related to the extension api enhancement New feature or request labels Nov 25, 2020
@jakolehm jakolehm added this to the 4.0.0 milestone Nov 25, 2020
@jakolehm jakolehm merged commit 4e02e08 into master Nov 26, 2020
@jakolehm jakolehm deleted the feature/auto-remove-extension branch November 26, 2020 07:40
@jakolehm jakolehm mentioned this pull request Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/extension Something to related to the extension api enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lens should notice added/removed extension folders
3 participants