0

Suggestion: Chronological constraint on insert/replace events

I've just noticed that multiple submissions of an insert or replace <yml:form> results in a free-for-all. If the responses arrive out of order, the result of the first submission can overwrite the result of the last submission, for example.

The fix I'd suggest is discarding the results of a form submission instead of inserting them into the DOM if the results of a later form submission have already been inserted into (or replaced) the same target element.

<yml:a> is probably also affected.

by
2 Replies
  • Let me take a look into this and prepare some samples for the teams to showcase this issue. Since the yml tags are self contained Yahoo! widgets they should be controlling the ajax processing stack. If we create a simple priority stack of 1 request we should be able to force out old requests before they complete.

    Looking deeper.
    Jon

    QUOTE (Jared @ Apr 16 2009, 02:26 PM) <{POST_SNAPBACK}>
    I've just noticed that multiple submissions of an insert or replace <yml:form> results in a free-for-all. If the responses arrive out of order, the result of the first submission can overwrite the result of the last submission, for example.

    The fix I'd suggest is discarding the results of a form submission instead of inserting them into the DOM if the results of a later form submission have already been inserted into (or replaced) the same target element.

    <yml:a> is probably also affected.
    0
  • Great, thanks for looking into this.

    In addressing this issue, I think it's important not to impose stricter limitations on ajax requests than browsers naturally have. That would be crippling the Y!OS platform. In particular:
    1) It's okay for a page to have multiple outstanding requests.
    2) It's okay for ajax calls to complete and to update the page out of order.

    What I'm suggesting in this thread is quite narrow. It's only when multiple <yml:a> and/or <yml:form> ajax calls are targeting the same element that there's a problem worth addressing.

    Example 1
    Suppose we have three links:
    <yml:a href="a.html" insert="foo">A</yml:a>
    <yml:a href="b.html" insert="foo">B</yml:a>
    <yml:a href="c.html" insert="foo">C</yml:a>
    If someone clicks all three quickly in the ordering (a, b, c), then it would be acceptable for the person to see the content displayed inside the "foo" element in any of these orderings, depending on which order the responses arrive:
    (a,b,c)
    (a,c)
    (b,c)
    ©
    but not in any ordering where b precedes a or c precedes a or b.

    Example 2
    Suppose we have a form:
    <yml:form ... replace="bar">
    <input type="text" name="baz" />
    <input type="submit" />
    </yml:form>
    If someone submits the form three times with the text input containing "A", "B", and "C", in that order, then it would be acceptable to see the responses displayed in the same orderings that were acceptable in the first example, but unacceptable for the results of any submission to be displayed and then replaced by the result of an earlier submission. The same constraints should apply if there were multiple <yml:form> elements all targeting the same destination element ID.

    Let me reemphasize that, in my opinion, these proposed ordering constraints should not apply globally across all <yml:a> and <yml:form> elements, since that would amount to crippling the platform (e.g. canceling legitimate requests or introducing artificial latency).
    0
This forum is locked.

Recent Posts

in Y!OS Suggestions