Giter VIP home page Giter VIP logo

Comments (19)

ivoviz avatar ivoviz commented on July 24, 2024 1

@AurelieV Doesn't seem to work for me, the error is still happening.

from ngx-moment.

bzums avatar bzums commented on July 24, 2024

This could be related:
http://www.syntaxsuccess.com/viewarticle/timeouts-and-timerwrapper-in-angular-2.0

from ngx-moment.

urish avatar urish commented on July 24, 2024

Duplicate: #44, #14, #42

from ngx-moment.

urish avatar urish commented on July 24, 2024

Can you please create a small plunker example the reproduces the issue?

from ngx-moment.

bzums avatar bzums commented on July 24, 2024

@urish the problem is that I dont know how to reproduce it exactly, it seems to be a timing issue and seems to occur very very rare. My suggestion would be to replace the setTimeout calls with the TimerWrapper but it is just a guess...

from ngx-moment.

urish avatar urish commented on July 24, 2024

Hi, can you please check if this fixes the issue for you?

https://github.com/urish/angular2-moment/blob/issue-48/src/TimeAgoPipe.ts

Thanks!

from ngx-moment.

ivoviz avatar ivoviz commented on July 24, 2024

@urish Although you asked @bzums, I've checked and it seems the problem goes away with the issue-48 branch. Imho merge and release! :)

from ngx-moment.

urish avatar urish commented on July 24, 2024

Thanks @ivoviz !

Can you please describe how you checked it?

from ngx-moment.

ivoviz avatar ivoviz commented on July 24, 2024

@urish Basically I have a site where I use amTimeAgo 50+ times / page. When I have that many elements and the times are between 0-60 minutes ago (so they should change approx. every minute) the errors occur really easily, basically every minute, or even more often. Using your patch I've left the site there for half an hour and it's still functioning, not a single error.

from ngx-moment.

urish avatar urish commented on July 24, 2024

Thanks @ivoviz ! And are all the timers updating as they should?

from ngx-moment.

ivoviz avatar ivoviz commented on July 24, 2024

I'm not sure about that, it seems like there are cases when the timers don't update, I'll see if I can reproduce.

from ngx-moment.

ivoviz avatar ivoviz commented on July 24, 2024

@urish Actually the timers never update on their own, sadly. Unless there's an other change, they stay exactly the same.

from ngx-moment.

urish avatar urish commented on July 24, 2024

@ivoviz Thanks for the input! For now we will not merge the PR, at least until there is a good solution for the timers not updating problem.

from ngx-moment.

AurelieV avatar AurelieV commented on July 24, 2024

@ivoviz @urish juste add cdr.detectChanges() in the timeOut callback and it will normally works :)
I have the same case as @ivoviz (lot of components inferior to one minute) and it works for me.

this._currentTimer = window.setTimeout(() => {
     this._cdRef.markForCheck();
     this._cdRef.detectChanges();
 }, timeToUpdate);

Can you please test it, and I will be glad to add a PR if it works for everybody

from ngx-moment.

ivoviz avatar ivoviz commented on July 24, 2024

@AurelieV I would gladly test this, just a quick question before: Is this change based on the master, or #55?

from ngx-moment.

AurelieV avatar AurelieV commented on July 24, 2024

@ivoviz on master

from ngx-moment.

AurelieV avatar AurelieV commented on July 24, 2024

@ivoviz Damn. I think it is still the way to explore, we just have to find the good time to call it :s.

from ngx-moment.

josx avatar josx commented on July 24, 2024

I have read and all doc talks about calling detectChanges() as @AurelieV code.
can someone do a pluckr with the example of the problem? I would be great to track the problem and possible fixes.

Just for the record:
michaelbromley/ngx-pagination#69
angular/angular#6005

from ngx-moment.

urish avatar urish commented on July 24, 2024

Not sure if this still happens with angular 2.0.1. If relevant, please reopen.

from ngx-moment.

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.