Git Product home page Git Product logo

Comments (5)

buschtoens avatar buschtoens commented on May 29, 2024

Sounds exactly like what I recall from the meeting. 👍🏼

I have a few minor notes though:

  • Register a new router service that proxies all its methods to the host's router service. Every method invocation that's passed should include a deprecation warning.

Unconditionally creating a proxy router service in every engine may cause unintended side-effects, e.g. some addon or user code may check for the existence of a router service and use different adapters then. Considering that addons that deal with routing need to special-handle engines in one way or another, if they want to be compatible, the likelihood is not zero, that the mere presence of a router service could change the behavior.

On the other hand, this may be super-edge-case-y, SemVer-lawyering-wise still okay and not even a real issue.

We could however only setup the proxy router service, when a service with that name is actually injected into the engine.

Which is a nice segue into my next nitpick:

[...] proxies all its methods to the host's router service [...]

This would not work for these two scenarios:

  • Engine implements and registers the router service by itself. It is not an external injection.
  • The host remaps / aliases the router service name and e.g. injects mock-router as router.
    engines = {
      superBlog: {
        dependencies: {
          services: [
            // name in superBlog engine: 'store'
            // name in host: 'store'
            'store',
    
            // name in superBlog engine: 'router'
            // name in host: 'mock-router'
            { 'router': 'mock-router' }
          ]
        }
      }
    };

Instead of always "blindly" proxying to the host's router service, I would prefer, if we could somehow "wrap" the actual router service instance, when it gets registered / injected. This way we would:

  • only make router available in engines, where it already was available
  • don't accidentally break custom interfaces introduced by users, who use some sort of custom router service, i.e. not the app-router.

For instance, at @ClarkSource we've been using our own make-shift engine-specific router service as router inside many engines for 2½ years now, basically ever since I opened #587.


We should also consider allowing an experimental build flag to allow usage of an alpha engine-specific router which we can iterate upon starting in 0.9. This approach should allow opt-in usage of a router service similar to that in #669 for developers who are willing to experiment and endure some breaking changes.

Big 👍🏼.

from ember-engines.

rwjblue avatar rwjblue commented on May 29, 2024

Ya, sounds like a good summary here to me.

from ember-engines.

villander avatar villander commented on May 29, 2024

Great summary, thanks @dgeb

But I think you can put here how the new router service will work in js and template files and the relation with *External methods to give more context

from ember-engines.

dgeb avatar dgeb commented on May 29, 2024

Closing now, since this has effectively been resolved via the deprecation introduced in #764. As discussed in that PR, the assumption about automatic injection of the host's router was incorrect. This is greatly simplifying, since we only needed to deprecate injection of the router service and no longer need to deal with the complexities of a proxy router (which @buschtoens mentions above).

from ember-engines.

dgeb avatar dgeb commented on May 29, 2024

The one piece left todo is this:

We should also consider allowing an experimental build flag to allow usage of an alpha engine-specific router which we can iterate upon starting in 0.9.

This can be handled in a subsequent PR.

from ember-engines.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.