Giter Club home page Giter Club logo

Comments (7)

esttorhe avatar esttorhe commented on May 28, 2024

Hi @serluca thanks for pointing this out.

Currently throttle was an approach mimicking the implementation of ReactiveViewModel.
Right now we have more operators on RxSwift that could be used to accomplish this in a better way.

Haven't checked recently but chances are you are correct and the current behavior is not working 💯 of the time as one would have expected it to.

I'll give it a try again with the new operators and will fix it as soon as I can.

from rxviewmodel.

serluca avatar serluca commented on May 28, 2024

Hi @esttorhe

Not sure if can help but let me tell you my experience with RxViewModel (I'm having this on the latest release 3.1.3 and also on the pre-release 3.1.4).

As I said, I noticed that throttleSignalWhileInactive it fires signals while the active property is false. I also noticed that it doesn't fire as soon as my subject it sends the next signal, but there is a bit of delay. I looked into RxViewModel and I found that there is a property let throttleTime: NSTimeInterval = 2.

So it seems that the signal is not throttled waiting the didBecomeActive, but it fires when the throttleTime expires.

from rxviewmodel.

esttorhe avatar esttorhe commented on May 28, 2024

Yes thanks @serluca; I finally got some time off this week and I'll try to replace the throttle mechanism to use the pre defined throttle operator instead of rolling my own like I did when I first created this.

I'll try to release v. 3.1.5 by EOW.

If you would like to give it a try and know a version that uses the predefined operator and submit a PR that would be amazeballs 😬
But if not i'll be releasing this new version soon

from rxviewmodel.

RamwiseMatt avatar RamwiseMatt commented on May 28, 2024

Is there any status update on this? throttleSignalWhileInactive would be very helpful, provided it works!

from rxviewmodel.

esttorhe avatar esttorhe commented on May 28, 2024

OK; I've finally had some time to seat down and check the issue.

I change a little bit the behavior but everything is working as expected.

@serluca you are correct in your analysis that it will throttle based on the timer set.
This is the default behavior of the throttle operator (throttle only does it for a period of time).

The convenience operator throttleWhileInactive basically means that it will throttle the signal whenever the viewmodel is inactive (with a predefined period of time of 2 seconds)

TL;DR;: That part is working as designed.

On the other hand it shouldn't fire a signal when the property is set to false; I tested it locally and on a couple of machines and couldn't reproduce this behavior, could you provide a sample code that actually demonstrates that it's firing an event when set to false?

from rxviewmodel.

serluca avatar serluca commented on May 28, 2024

Hi @esttorhe

I'm currently in vacation, I'll try to send one as soon as possible, but based on what you have just described maybe is not an issue. I'll get back to you.

Thanks

from rxviewmodel.

esttorhe avatar esttorhe commented on May 28, 2024

I'm going to be closing this issue.

Please feel free to open another one if you still think this is a bug

from rxviewmodel.

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.