From 2f55d51c9a7bb9a7411741ba05f6a39aa19f3b5f Mon Sep 17 00:00:00 2001 From: joseph izang Date: Sun, 25 Jul 2021 01:39:11 +0100 Subject: [PATCH] fixed a bunch of plumbing with external persisted state of plugin manager --- .../components/plugin-manager-component.js | 4 +- .../src/lib/components/ActivePluginCard.tsx | 19 +++---- .../src/lib/components/rootView.tsx | 50 ++++++++++++++--- .../src/pluginManagerStateMachine.ts | 55 +++++++++++++++++-- 4 files changed, 103 insertions(+), 25 deletions(-) diff --git a/apps/remix-ide/src/app/components/plugin-manager-component.js b/apps/remix-ide/src/app/components/plugin-manager-component.js index 781bc51516..7fe602800b 100644 --- a/apps/remix-ide/src/app/components/plugin-manager-component.js +++ b/apps/remix-ide/src/app/components/plugin-manager-component.js @@ -53,7 +53,7 @@ class PluginManagerComponent extends ViewPlugin { } triggerEngineEventListener () { - this.engine.event.on('onRegistration', () => this.getAndFilterPlugins()) + this.engine.event.on('onRegistration', () => this.renderComponent()) } /** @@ -90,7 +90,7 @@ class PluginManagerComponent extends ViewPlugin { debugger this.call('manager', 'deactivatePlugin', name) _paq.push(['trackEvent', 'manager', 'deactivate', name]) - this.getAndFilterPlugins() + this.renderComponent() } onActivation () { diff --git a/libs/remix-ui/plugin-manager/src/lib/components/ActivePluginCard.tsx b/libs/remix-ui/plugin-manager/src/lib/components/ActivePluginCard.tsx index e6e5205973..19da8b2a0d 100644 --- a/libs/remix-ui/plugin-manager/src/lib/components/ActivePluginCard.tsx +++ b/libs/remix-ui/plugin-manager/src/lib/components/ActivePluginCard.tsx @@ -1,7 +1,6 @@ import { Profile } from '@remixproject/plugin-utils' -import React, { useState } from 'react' +import React, { useEffect, useState } from 'react' import { RemoveActivatedPlugin } from '../../pluginManagerStateMachine' -// import { RemoveActivatedPlugin } from '../../pluginManagerStateMachine' import { PluginManagerComponent } from '../../types' import '../remix-ui-plugin-manager.css' interface PluginCardProps { @@ -10,7 +9,7 @@ interface PluginCardProps { } pluginComponent: PluginManagerComponent buttonText: string - reRender: () => void + syncInactiveProfiles: () => void } // eslint-disable-next-line no-empty-pattern @@ -18,7 +17,7 @@ function ActivePluginCard ({ profile, pluginComponent, buttonText, - reRender + syncInactiveProfiles }: PluginCardProps) { const [displayName] = useState((profile.displayName) ? profile.displayName : profile.name) const [docLink] = useState((profile.documentation) ? ( @@ -26,13 +25,16 @@ function ActivePluginCard ({