-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
Helpers no longer work properly with scheduled run-loop queues in v2 #947
Comments
@scalvert this is the bug that I've been trying to pin down for a while. I've finally traced it down to the fact that all of the test failures were from components that schedule stuff on a run-loop queue. |
@drewlee thanks for chasing this down. This is very odd behavior, and I wonder whether this further changed when we imported and used the @rwjblue thoughts? |
I think we've root caused what is going on here (@stefanpenner, @scalvert, and myself). I should have a PR up soon with an explanation. |
#956 is a failing test PR for the underlying issue, with a detailed explanation of what is going on. Working on the fixes now. |
Test helpers, particularly
render
, seem to be out of sync with scheduled run-loop timers. This causes integration and acceptance tests to fail when a component schedules work on a queue (e.g.,afterRender
).I've create a simple use case to demonstrate the issue. It consists of a basic component that schedules programmatic focus placement on an
afterRender
queue. It is very similar to some of the test failures I've noticed within our applications after upgrading to v2: https://github.com/drewlee/helpers-async.There are two tests for the component. The first demonstrates the regression. What's particularly interesting is that running
getSettledState()
afterrender
/click
shows that the app still consists of pending timers and run-loop. The second test shows that a test can be coerced into passing by adding asettled
waiter immediately after callingrender
. However, the app is still not quite settled afterclick
resolves, so this seems to be symptomatic of all test helpers.I'm not exactly too sure whether the test helpers resolve prematurely before the run-loop stuff is complete, or whether the test helpers somehow trigger a new run loop. Especially given that the component's behavior is altered because the scheduled
focus
call ends up executing before the input is rendered (hence theCannot read property 'focus' of null
exception).What I did find, is that removing this noop then callback in helper-hooks.js resolves the issue. I'm fairly certain that it's there for a good reason, so I'm somewhat hesitant for suggesting its removal as this may be a symptom of an issue related to Ember source, Backburner, or even RSVP. It seems very enigmatic for the stuff we're trying to avoid in this RSVP config though.
The text was updated successfully, but these errors were encountered: