Skip to content

proper testcase for preserving 1st context fails#64

Draft
me-andre wants to merge 1 commit intowuct:masterfrom
me-andre:first_call_context_broken
Draft

proper testcase for preserving 1st context fails#64
me-andre wants to merge 1 commit intowuct:masterfrom
me-andre:first_call_context_broken

Conversation

@me-andre
Copy link
Contributor

@me-andre me-andre commented Mar 31, 2019

If we make "preserves the context of the first call" testcase just slightly more complex, we clearly see it doesn't actually preserve the context of the 1st call as promised.
What it does is preserving the context of the 1st call after the last animation frame. When animation frames happen and how often is the last thing a developer wants to care about, so current behavior is close to unpredictable and thus unreliable.
I personally see 2 solutions to this problem:

  1. Make no assumptions regarding context (like lodash.throttle). This is the smartest choice.
  2. Treat context as an argument and invoke the callback with the most recent context (if we want those dances around context).

@me-andre me-andre mentioned this pull request Mar 31, 2019
@wuct
Copy link
Owner

wuct commented Mar 31, 2019

Thanks for opening this PR. Do you mind to implement the second behavior you mentioned in this PR as well?

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.

2 participants