Giter Site home page Giter Site logo

Comments (6)

bigopon avatar bigopon commented on May 31, 2024 1

As far as I understand, this is caused by the choice of container from the hydration context:
...
That following change solves the problem:
...
However, it messes up the projection :(

The reason it solves the problem is because it disregard the hydration context hierarchy and start walking up the container hierarchy for resolving key. In the template, hydration context of the au-slot content of ce-l3' is my-app. I'm checking it now for a resolution of this issue.

from aurelia.

bigopon avatar bigopon commented on May 31, 2024

In the define hook of the ce-l1 I am registering the instance of ce-l1 to the hydration context.

Does this part matter whrther you get the right or wrong ce 1 instance?

from aurelia.

Sayan751 avatar Sayan751 commented on May 31, 2024

Does this part matter whrther you get the right or wrong ce 1 instance?

Yes, as the child items want to interact with the parent using the API provided by the parent. Hence, for my use case it is important that the correct CE is injected.

from aurelia.

bigopon avatar bigopon commented on May 31, 2024

If i understood the intention of the template correctly, shouldnt ce-1#2 be automatically injected into ce-3#ctor? @Sayan751
If so, what we do in define of ce-l1#define wouldnt matter, hence my question above. Also i think we should refrain from define hook, its power is quite too much (Im thinking we should remove it).

from aurelia.

Sayan751 avatar Sayan751 commented on May 31, 2024

Yes, you are right @bigopon! I misread your question about the define hook. If the normal injection works, then the define hook stuff won't matter. I have a hunch that this issue, and #1874, both are related to how au-slot is managing the containers.

from aurelia.

Sayan751 avatar Sayan751 commented on May 31, 2024

@bigopon This one https://stackblitz.com/edit/newinstanceforscope-with-au-slot?file=src%2Fmy-app.ts might also be related.

As far as I understand, this is caused by the choice of container from the hydration context:

container = hdrContext.parent!.controller.container.createChild({ inheritParentResources: true });

That following change solves the problem:

+ container = hdrContext.parent!.controller.container.createChild({ inheritParentResources: true });
- container = hdrContext.controller.container.createChild({ inheritParentResources: true });

However, it messes up the projection :(

from aurelia.

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.