Giter Club home page Giter Club logo

Comments (2)

gund avatar gund commented on July 25, 2024

Hey, thanks for providing reproduction repo - it was very useful to debug the issue!

I have found the problem and it lays down in a way you process input changes or rather using a setter instead of a OnChanges lifecycle hook =)

The reason setters don't work in your case is that inputs are set on dynamic components before the outputs are subscribed and if you know observables will miss any events that happened before the subscription, and since you are setting the id in the setter which triggers the loading state change the output will miss this first event and only work on the subsequent events.

So to fix your issue you could either use OnChanges hook to set the id as this will delay the event until after outputs were processed or you can add a timeout when setting id (I've added the timeout just to check and it fixed the issue).

I would recommend/prefer to always use OnChanges hook as it is semantically cleaner and also it always guarantees that all initialization logic of your constructors/props is executed but you are free to do as you please 😊

With regards to this issue I believe we could reverse the order of processing first outputs and then inputs to make it consistent with what seems like Angular is doing under the hood but to be hones I would rather not rely on the order of what is processed first/last...

What do you think?

from ng-dynamic-component.

gund avatar gund commented on July 25, 2024

I'm closing this issue as it's outdated and no fix is planned for it.
If you want to reopen the discussion please feel free to open a new issue.

from ng-dynamic-component.

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.