-
-
Notifications
You must be signed in to change notification settings - Fork 604
-
-
Notifications
You must be signed in to change notification settings - Fork 604
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
Serialize load requests #356
Comments
Currently I feel that this is a bit out of scope for fancytree, since 'source' accept many other formats, not just xhr. Also it can not reliably be cancelled (http://stackoverflow.com/a/4551178/19166):
I think that there may be other tools to prevent this beforehand, e.g. Debounce (http://benalman.com/code/projects/jquery-throttle-debounce/examples/debounce/) |
Indeed, the request cannot be canceled but can be quietly discarded. The issue is that any external handling will not have control over fancytree interface (ie, nice rotating progress circle); an internal implementation (as basic as it may be) would be much more user-friendly. Also, with an external handling (which we have done) there is this issue: the tree processing (using reload) is by your implementation async (and it should be), therefore a second reload() must be delayed after the current tree processing is complete (after the complete event), otherwise it will cause errors. This has nothing to do with XHR response order, it happens with static reload()'s as well, so it's pretty difficult to avoid without making a wrapper for fancytree, which is obviously fancytree specific (debounce won't handle this, that just serializes XHR requests). It would be nice if at least this second point would be resolved in some manner. |
Hello,
I have the following problem: I'm trying to merge fancytree into a text search widget. When the user types, there are possibly overlapping calls to reload(url). These cause 2 problems: the tree becomes out of sync with the load requests and some error is triggered at jQuery level (Assertion failed: only init supported). I have 2 workarounds for it, either load the JSON data externally with a proper serialization check and call reload(object), or delay reloads while the tree is not done reloading. It would be nice though if this would be implemented internally in fancytree (assign an id to every reload() call, propagate via closure to XHR complete callback, then silently discard XHR responses that are not the latest).
The text was updated successfully, but these errors were encountered: