@diosmosis opened this Pull Request on March 22nd 2022 Member

Description:

This PR provides on demand loading of a plugin's Vue module, so it does not have to be loaded on each page load.

To set a plugin's Vue module to be loaded on demand you'd have to:

  • override Plugin::shouldLoadUmdOnDemand() and return true
  • if the plugin defines angularjs adapters, move them all to a separate file manually included via the AssetManager event and set the component property to a reference like { plugin: 'MyPluginName', component: 'MyComponentName' }.

If you need to use a plugin that's loaded like this in another plugin, you won't be able to import as you would normally. Instead you'll need to use the importPluginUmd method:

import { importPluginUmd } from 'CoreHome';

importPluginUmd('TagManager').then((module: typeof import('TagManager')) => {
  // ...
});

Note: that adapters for stores or anything that gets added via angular(...).adapter will not be available, so making a plugin load on demand is a potential BC break. For TagManager this is acceptable since the old models weren't meant to be reused.

To see a plugin that uses this, see: https://github.com/matomo-org/tag-manager/pull/461

Review

@diosmosis commented on March 22nd 2022 Member

Adding this to the current milestone, but I'm not sure when it is desired to include it.

@github-actions[bot] commented on April 14th 2022 Contributor

This issue is in "needs review" but there has been no activity for 7 days. ping @matomo-org/core-reviewers

@github-actions[bot] commented on July 20th 2022 Contributor

This PR was last updated more than one month ago, maybe it's time to close it. Please check if there is anything we still can do or close this PR. ping @matomo-org/core-reviewers

@github-actions[bot] commented on July 29th 2022 Contributor

This issue is in "needs review" but there has been no activity for 7 days. ping @matomo-org/core-reviewers

@sgiehl commented on August 22nd 2022 Member

@diosmosis would you mind rebasing that one to 5.x-dev? We've decided not to put that into the last 4.x release to lower the risk of regressions we might need to fix. Also we will have more time to test that, after it was merge to 5.x-dev...

@diosmosis commented on August 22nd 2022 Member

@sgiehl should be up to date w/ 5.x-dev

@diosmosis commented on August 26th 2022 Member

fixed

@sgiehl commented on August 29th 2022 Member

@diosmosis Could you check the failing UI tests? Seems the language selection is no longer visible in installation and updater. Seems there is a javascript error in that case.

@diosmosis commented on August 30th 2022 Member

@sgiehl fixed

This Pull Request was closed on August 31st 2022
Powered by GitHub Issue Mirror