Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with input rate policies #2404

Merged
merged 8 commits into from May 8, 2019
Merged

Fix issue with input rate policies #2404

merged 8 commits into from May 8, 2019

Conversation

cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Apr 25, 2019

See #2387 for a motivating example. In that example, the slider starts off with the correct Debouncer input rate policy, but when the slider is updated, it's policy changes to the default Invoker (i.e. immediate) rate policy.

It seems this happens because InputRateDecorators's $ensureInit() method is called with a name that contains both the input id and type. As a result, when the type of an input changes, it fails to look up the input rate policy and ends up defaulting to Invoker() instead.

Copy link
Contributor

@alandipert alandipert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original code, the explicit contribution of type to the setInput() key in addition to id makes me wonder if this is removing some historical feature.

Is it possible that having multiple inputs with the same ID, but different types, is a thing someone would do for some reason?

If we can rule that out then this seems like solid improvement.

srcjs/input_rate.js Outdated Show resolved Hide resolved
srcjs/input_rate.js Outdated Show resolved Hide resolved
srcjs/input_rate.js Outdated Show resolved Hide resolved
srcjs/input_rate.js Outdated Show resolved Hide resolved
@cpsievert
Copy link
Collaborator Author

cpsievert commented May 3, 2019

Is it possible that having multiple inputs with the same ID, but different types, is a thing someone would do for some reason?

I don't think it's intended for the rate policy to depend on the input type, so I'm fairly certain that this.inputRatePolicies was always meant to be using inputId (i.e., name) rather than both the name and the type.

@cpsievert cpsievert mentioned this pull request May 8, 2019
@cpsievert cpsievert dismissed alandipert’s stale review May 8, 2019 20:21

Already reviewed...also Joe has stepped in to provide a review

@wch wch merged commit a4a49a3 into master May 8, 2019
@wch wch deleted the inputRateName branch May 8, 2019 21:24
cpsievert added a commit that referenced this pull request May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants