question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dependencies between nested engines

See original GitHub issue

Hello,

Can you please help me to describe dependencies for following structure?

Host Application ->
   service:ajax
   Nested 1 (async routable) ->
     service:socket
     Nested 1.1 (async routable)
       -> how to pass socket service via dependencies from 1 to 1.1 ?
     Nested 1.2 
   Nested 2 (async)

In host app I could write something like this in app.js, but the trouble is that socket service is not available until I load it.

Nested1.1: {
    dependencies: {
      services: ['ajax', 'socket']
    }
  }

I tried to write it in Nested1 engine.js file, but it seems Nested1.1 is looking for dependencies in Host app and not in parent engine ? service:socket is quite big and I wouldn’t want to move it on Host level.

If this make sense routes in Nested 1 described like this

export default buildRoutes(function() {
  this.route('participant', { path: '/:id' }, function() {
    this.route('index', { path: '/' }, function() {
      this.mount('viewer');  // This is Nested 1.1 mount
    });
  });  
});

I finally shared socket as a property of the global app service, but do not think it’s good.

Thank you.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:8
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
lvegeranocommented, Nov 15, 2018

I’m running into this issue as well but with externalRoutes dependencies. I have an engine that I mount to the host app and also to another engine that is mounted to the same host app.

Host App
    mounts: Engine A
    mounts: Engine B
        mounts: Engine A
Engine A deps:
   externalRoutes: {
        'route-dep': 'host.app.route',
    }
Engine B deps
   Engine A deps
       externalRoutes: {
           'route-dep': 'engine.b.route'
       }

But when Engine A tries to route to route-dep from Engine B, instead of routing to engine.b.route it routes to host.app.route Is there a way around this?

0reactions
swarnavalliscommented, May 22, 2019

@swarnavallis and this is exactly what I asked but didn’t find any practical solution without sharing via host app.

So is there any possibility that this will be addressed in near future? @catz @stefanpenner

Read more comments on GitHub >

github_iconTop Results From Across the Web

Declaring Dependencies between Subprojects
Project dependencies model dependencies between modules. Effectively, you are saying that you depend on the main output of another project. In a Java-based ......
Read more >
Azure ARM dependencies between nested templates
I've created a template that has two nested templates. The first nested template defines an SQL server as:
Read more >
'Nested' dependencies question - Forum - SolarWinds THWACK
For each site, I setup a dependency with the PAN firewall node as the parent, and a group containing all remaining nodes (switches...
Read more >
DependsOn attribute - AWS CloudFormation
It automatically determines which resources in a template can be parallelized and which have dependencies that require other operations to finish first. You...
Read more >
package.json - npm Docs
If you need to make specific changes to dependencies of your dependencies, for example replacing the version of a dependency with a known...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found