drawio-desktop icon indicating copy to clipboard operation
drawio-desktop copied to clipboard

Plugins work only once after reload

Open zahdimar opened this issue 1 year ago • 1 comments

Preflight Checklist

  • [x] I agree to follow the Code of Conduct that this project adheres to.
  • [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Plugin doesn't work after 2 reloads. When you add plugin (Extras - Plugins - Add) it has path like plugins/trees/trees.js, but it doesnt work until reload. After reloading it works, but it has path ./plugins/trees/trees.js. After next reload you have path ./plugins/trees/trees.js and not working plugin.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Extras - Plugins'
  2. Add some plugin, check the path. It should be like 'plugins/...'
  3. Close application
  4. Open some already existed .drawio file from file explorer It doesn't reproduce, if you open file from File - open or File - Open recent
  5. Check that plugin is working and it path has changed './plugins/...'
  6. Reload application
  7. Check that plugin doesn't work and it path has changed path './plugins/...'

Expected behavior After opening files from anywhere you have working plugins

Screenshots step 2 image step 3 image step 4 image

  • draw.io version 23.0.2

Desktop (please complete the following information):

  • OS: windows 11 (23H2 + russian OS language)
  • Desktop application

Additional context I had almost the same issue several month ago and it was fixed but it appears one more time... https://github.com/jgraph/drawio/issues/3395

zahdimar avatar Jan 30 '24 11:01 zahdimar

Hi, I can add some info on the cause:

  • after installing a plugin, it is saved with full-path file://<full-path-to-js-file>
  • In App.main, here the loading code assumes that it is a path starting with plugins or else it calls getPluginFile:
let pluginFile = await requestSync({
  action: 'getPluginFile',
  plugin: plugins[I]
  });

which in turn assumes it is a file-name only see here

so the issue is either when storing the plugin file in the settings as full-path or at processing it no considering that it is a full-path

ariel-bentu avatar Mar 20 '24 12:03 ariel-bentu

Please try the new release 12.4.0

m-mohamedin avatar May 13 '24 16:05 m-mohamedin