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

UI widget + autostart: wrong order of events / timing issues #431

Closed
hujer opened this issue Nov 30, 2011 · 2 comments
Closed

UI widget + autostart: wrong order of events / timing issues #431

hujer opened this issue Nov 30, 2011 · 2 comments

Comments

@hujer
Copy link

hujer commented Nov 30, 2011

Causing this: http://www.plupload.com/punbb/viewtopic.php?id=684

The problem is that on uploader.init, the FilesAdded event is bound, which then fires QueueChanged if any actual files were added.

In the UI widget, the autostart event is bound to FilesAdded, too. The uploaded file list (actual html) gets updated on QueueChanged. The problem is that in _handleFileStatus, case plupload.UPLOADING the widget is trying to scroll to the actual file being uploaded (using rowOffset = $('#' + file.id).position().top + $('#' + file.id).height();) while this list is actually not yet popupulated yielding $('#' + file.id) an empty array. Here comes the error reported in the forum.

@jayarjo
Copy link
Contributor

jayarjo commented Dec 1, 2011

The problem here is a bit deeper then that. In addition to handlers defined in UI widget, there is also a core handler for FilesAdded, which triggers QueueChanged event before the UI widget's FilesAdded handler is even called. So that by the moment file list should already be populated. The problem is caused by the fact that QueueChanged in the core is detached from the flow and triggered with a delay of 1ms, which is sometimes just enough to screw the event order and the whole thing.

But thank you for bringing this to our attention, your investigation made me realize the root of the problem :)

jayarjo added a commit that referenced this issue Dec 1, 2011
@hujer
Copy link
Author

hujer commented Dec 5, 2011

Ok thanks :)

@jayarjo jayarjo closed this as completed Dec 5, 2011
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

No branches or pull requests

2 participants