GMOD / jbrowse-components

Source code for JBrowse 2, a modern React-based genome browser
https://jbrowse.org/jb2
Apache License 2.0
211 stars 63 forks source link

Can't uninstall plugin in UI due to name inconsistencies #2052

Closed garrettjstevens closed 3 years ago

garrettjstevens commented 3 years ago

Runtime plugins have two names, the name in the config file and the name in the plugin class. For example, the current Biothings plugin in the plugin store has this config:

{
  "name": "Biothings",
  // ...other stuff
}

And this plugin class name:

export default class extends Plugin {
  name = 'MyGeneAdapter'

  install(pluginManager: PluginManager) {
    // stuff
  }
}

When you see this plugin in the plugin store, it looks like this: image But when you install it, it uses the plugin class name instead: image

The name inconsistencies cause a few problems:

There probably needs to be a way to deduplicate the two names or ensure they are the same.

cmdcolin commented 3 years ago

Interesting...Could we remove one or the other? E.g. just have the URL and rely on the static name field, or just use the name from the config?

garrettjstevens commented 3 years ago

Possibly, but we might have to re-work some things. The problem I see is that JBrowse needs the config name in order to know what global variable the plugin got added to, so you can't access the plugin to see the class attribute name without the config name. But core plugins don't have a config name, so they need to keep the plugin class attribute name.

garrettjstevens commented 3 years ago

Also, the plugin removal in the UI only works currently if the class attribute name is the config name with "Plugin" on the end. For example, the MsaView plugin works because the config name is "MsaView" and the class attribute name is "MsaViewPlugin".

garrettjstevens commented 3 years ago

Some observations from backlog meeting:

Also, another solution @cmdcolin suggested is that we could try making plugins be esm modules that are imported with asynchronous import and then we don't have to give them a global name in the config.