Code Monkey home page Code Monkey logo

Comments (7)

atscott avatar atscott commented on May 9, 2024 1

Why doesn't afterNextRender work here?

afterNextRender did not support updating state until 432afd1 which just missed the release this week

That being said, this can be solved by using OnPush which will run local change detection and prevent NG0100.

OnPush doesn't prevent NG0100 other than the fact that NG0100 is broken and can't detect errors in OnPush components. Using signals to prevent NG0100 works the same in default and OnPush components.

from angular.

JoostK avatar JoostK commented on May 9, 2024

This is a ECAIHBC situation. Signals don't currently affect how change detection is handled, it's only a reactive envelope around a value at the moment. If that value has already been read in a template before its value is being updated during the same change detection cycle (in ngOnInit) then the previously checked template becomes out-of-date, violating Angular's top-down data flow requirements.

The details of how this works with signals may change in the future, but as of right now this is working as designed.

from angular.

JeanMeche avatar JeanMeche commented on May 9, 2024

That being said, this can be solved by using OnPush which will run local change detection and prevent NG0100.

from angular.

rainerhahnekamp avatar rainerhahnekamp commented on May 9, 2024

Ouch, hello, guys, and thanks for your answers.

I've sent poor @ValentinBossi over from the NgRx repo and promised him you know of some Signal-based solution/alternative that already prevents the NG0100.

Why doesn't afterNextRender work here? I understood it as a "better" version of Promise.resolve(() => ....). Unfortunately, it also triggers NG0100.

from angular.

rainerhahnekamp avatar rainerhahnekamp commented on May 9, 2024

@atscott, thanks for the clarification!

from angular.

atscott avatar atscott commented on May 9, 2024

I'm also going to close this as fixed by 432afd1. That PR addressed the issue where updating a signal that's read in another view attached to ApplicationRef would not work and still cause NG0100.

from angular.

angular-automatic-lock-bot avatar angular-automatic-lock-bot commented on May 9, 2024

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

from angular.

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.