Code Monkey home page Code Monkey logo

Comments (6)

k3nsei avatar k3nsei commented on June 16, 2024

I think that it would be not optimal to run changes detection whenever something changes it's visibility. Especially when you have many elements that are tracked. So to have best performance I think that change detection should be run based of a results from inViewportAction and then inside it user of library would call ChangeDetectorRef.detectChanges(); when needed as explicit task.

from ng-in-viewport.

karptonite avatar karptonite commented on June 16, 2024

I'm not an expert in NgZone and change detection. I assumed based on issue #176, that it was the intention for the loadOnIntersection event to emit inside Zone. It seemed to me that the behavior now is what the poster in issue #176 was asking for as an option. But I could definitely be misunderstanding this.

My use case isn't about change detection, but about dispatching an action to NGRX inside of NgZone, as described here: https://ngrx.io/guide/store/configuration/runtime-checks#strictactionwithinngzone.

I can always fix this at my end by calling dispatch inside of ngZone.run, but I reported this here because it seemed like there was a significant change between version 13 and 15, and that it might be a breaking change for those relying on the previous behavior. It may well be that there is no change, and I am misunderstanding it. It may also be that there is a change, and it is a good one for performance.

from ng-in-viewport.

k3nsei avatar k3nsei commented on June 16, 2024

@all-contributors please add @karptonite for bug

from ng-in-viewport.

allcontributors avatar allcontributors commented on June 16, 2024

@k3nsei

I've put up a pull request to add @karptonite! 🎉

from ng-in-viewport.

karptonite avatar karptonite commented on June 16, 2024

Thanks! As I mentioned, this might be a negative for performance, and it might be better to either ask people to handle the events with NgZone themselves, or add an option to take it out of NgZone, as requested in #176. I'm not sure, honestly, but this should restore the previous behavior for my use case, anyway!

from ng-in-viewport.

k3nsei avatar k3nsei commented on June 16, 2024

The library should not expect Angular users to use advanced strategies and should work with the framework's defaults. It was also a nice way of testing automatic releasing.

from ng-in-viewport.

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.