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 issues with reload patchers #13

Open
matortheeternal opened this issue Feb 28, 2019 · 4 comments · May be fixed by #25
Open

Fix issues with reload patchers #13

matortheeternal opened this issue Feb 28, 2019 · 4 comments · May be fixed by #25
Assignees
Labels

Comments

@matortheeternal
Copy link
Member

We need to be able to reload controllers/settings tabs, among other things.

@mrudat
Copy link

mrudat commented May 22, 2020

...this seems to work? or is there more magic somewhere that's not immediately obvious?

    let service = this,
        patchers = [],
        tabs = [];

    this.resetTabs = function () {
      tabs = [{
          label: 'Build Patches',
          templateUrl: `${moduleUrl}/partials/buildPatches.html`,
          controller: 'buildPatchesController'
      }]
    }
    this.resetTabs();

and:

    $rootScope.$on('reloadPatchers', () => {
        tabs.forEach(tab => {
            if (!tab.templateUrl) return;
            $cacheFactory.get('templates').remove(tab.templateUrl);
        });
        service.resetTabs();
        service.reloadPatchers();
        service.loadSettings();
    });

@mrudat
Copy link

mrudat commented May 22, 2020

To support the case where patcherPath != 'modules\${info.id}', this seems to work:

    this.reloadPatchers = function() {
        let patcherPaths = patchers.map(patcher => patcher.info.path);
        patchers = [];
        patcherPaths.forEach(moduleService.loadModule);
    };

and to save the path:

     let upfLoader = function({module, fh, moduleService}) {
+        // save the path for if we need to reload later.
+        module.info.path = module.path;
         Function.execute({
             registerPatcher: patcherService.registerPatcher,

Although, perhaps it should be more like:

patcherService.getPatcher(module.info.id).path = module.path;

and:

let patcherPaths = patchers.map(patcher => patcher.path);

@matortheeternal
Copy link
Member Author

that looks good, willing to submit a PR for it?

@mrudat mrudat linked a pull request Jun 11, 2020 that will close this issue
@mrudat
Copy link

mrudat commented Jun 11, 2020

Done. Please see #25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants