Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

disabled prop for dcc.Interval is not used. #325

Closed
4 tasks
T4rk1n opened this issue Oct 11, 2018 · 5 comments
Closed
4 tasks

disabled prop for dcc.Interval is not used. #325

T4rk1n opened this issue Oct 11, 2018 · 5 comments

Comments

@T4rk1n
Copy link
Contributor

T4rk1n commented Oct 11, 2018

We have a disabled prop in the prop type definition of the Interval component, but it is not actually used by the code to disable the interval. Either remove it as we have the max_intervals=0 logic to stop the interval or make it stop the interval.

https://community.plot.ly/t/interval-component-cannot-be-disabled-via-callback/14455

Proposed solution:

  • replace the props argument in setInterval by this.props.
  • remove the disabled check from the interval.
  • check for disabled prop in componentWillReceiveProps.stop the loop if false .
  • restart the loop on disabled = True in componentWillReceiveProps if it was stopped.
@T4rk1n
Copy link
Contributor Author

T4rk1n commented Oct 19, 2018

Actually, we check for disabled only while doing setProps in the interval, but it takes the props from arguments and not this so it isn't updated. It's also the wrong place for that check as the loop will still run after setting disabled.

The disabled props should actually be checked in componentWillReceiveProps and stop the loop if false.

@shammamah-zz
Copy link
Contributor

@T4rk1n By "stop the loop", do you mean that window.clearInterval should be called? Or is there some other behaviour that should occur?

@T4rk1n
Copy link
Contributor Author

T4rk1n commented Nov 29, 2018

Yes that is what I meant.

@philip-peterson
Copy link
Contributor

This issue is addressed by #436

@alexcjohnson
Copy link
Collaborator

Closed by #436 - thanks @philip-peterson 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants