Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[bz5440307] ac.composite.execute() fails with an empty children list #60

Closed
add0n opened this Issue · 2 comments

3 participants

@add0n

If you pass an empty object for the children property in your cfg to ac.composite.execute(), Mojito will sort of just hang there. I think I've tracked the issue down to lines 260-262 of composite.common.js (in the function AdapterBuffer.done).

What I think happens is that the buffer.counter property will start at 0, and gets decremented to -1:

if(--this.buffer.counter === 0){
this.callback();
}

... so this.callback() will never execute. In my case, I'd greatly prefer it if it checked for counter <= 0 instead of === 0, so that it could handle empty children objects elegantly.

FYI, my current workaround is to include a dummy child that won't get output anywhere.

@imalberto
Owner

Is a composite mojit with no "children" considered valid configuration ?
If not, then perhaps do the same check as in ac.composite.done() and throw an error if size is 0.

@caridy
Owner
            if (!children || Y.Object.size(children) === 0) {
                throw new Error('Cannot run composite mojit children because' +
                                ' there are no children defined in the' +
                                ' composite mojit spec.');
            }

In 0.5.x we have that check in place.

@caridy caridy closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.