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

Fix plugin initialization when browser is refreshed #4008

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions packages/plugin-ext/src/hosted/browser/hosted-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export class HostedPluginSupport {
}
const rpc = this.createServerRpc(pluginID, hostKey);
const hostedExtManager = rpc.getProxy(MAIN_RPC_CONTEXT.HOSTED_PLUGIN_MANAGER_EXT);
hostedExtManager.$stopPlugin('');
hostedExtManager.$init({
plugins: plugins,
preferences: this.preferenceServiceImpl.getPreferences(),
Expand Down
11 changes: 8 additions & 3 deletions packages/plugin-ext/src/plugin/plugin-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
$stopPlugin(contextPath: string): PromiseLike<void> {
this.activatedPlugins.forEach(plugin => {
if (plugin.stopFn) {
plugin.stopFn();
try {
plugin.stopFn();
} catch (e) {
console.error(e);
}
}

// dispose any objects
Expand All @@ -83,15 +87,16 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
dispose(pluginContext.subscriptions);
}
});

return Promise.resolve();
}

$init(pluginInit: PluginInitData, configStorage: ConfigStorage): PromiseLike<void> {
this.storageProxy = this.rpc.set(
MAIN_RPC_CONTEXT.STORAGE_EXT,
new KeyValueStorageProxy(this.rpc.getProxy(PLUGIN_RPC_CONTEXT.STORAGE_MAIN),
pluginInit.globalState,
pluginInit.workspaceState)
pluginInit.globalState,
pluginInit.workspaceState)
);

// init query parameters
Expand Down