Regression: cannot add Scenes in consecutive frames (was: "NEED_SIZE_FOR -> Uncaught TypeError")
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 249
- PR merge metrics
- No merged PRs in 30d
Description
**Edit:** minimalist reproduction:
``` js
var FamousEngine = require('famous/core/FamousEngine');
var Node = require('famous/core/Node');
var Size = require('famous/components/Size');
var DOMElement = require('famous/dom-renderables/DOMElement');
var testDiv = function(id) {
var div = document.createElement('div');
div.style.display = 'none';
if (id) div.id = id;
document.body.appendChild(div);
return div;
}
var clock = FamousEngine.getClock();
FamousEngine.init();
var scene1 = FamousEngine.createScene('body');
clock.setTimeout(function() {
var div = testDiv('scene2');
var scene2 = FamousEngine.createScene('#scene2');
}, 1); // values from 1 to ~33 make this fail. 0 and roughly above 33 is fine.
```
This worked fine in 0.5.2 but since 0.6 (I think. Definitely since 0.6.2) this throws an `Uncaught TypeError: this._commandCallbacks[command] is not a function`. The value of `command` here is `NEED_SIZE_FOR`.
(rest of original post follows below)
Taking a quick look around, it looks like this is handled only in `Compositor.prototype.drawCommands()` but is reaching the `Context.prototype.receive()` loop too.
Logging the `commands` queue in both shows this order:
```
Compositor.drawCommands [TIME, 505.2819999982603, WITH, "#fview5", READY, WITH, "#fview5", READY, NEED_SIZE_FOR, "#node3_scene_div", TIME, 505.2819999982603, NEED_SIZE_FOR, "#node4_scene_div"]
Context.receive [29, 505.2819999982603, WITH, "#fview5", READY, WITH, "#fview5", READY, NEED_SIZE_FOR, "#node3_scene_div", TIME, 505.2819999982603, NEED_SIZE_FOR, "#node4_scene_div"]
Context.receive loop dequeue READY
Context.receive loop dequeue WITH
Context.receive [TIME, 505.2819999982603, WITH, "#fview5", READY, WITH, "#fview5", READY, NEED_SIZE_FOR, "#node3_scene_div", TIME, 505.2819999982603, NEED_SIZE_FOR, "#node4_scene_div"]
Context.receive loop dequeue READY
Context.receive loop dequeue NEED_SIZE_FOR
Uncaught TypeError: this._commandCallbacks[command] is not a function
receive @ Context.js:274
handleWith @ Compositor.js:138
drawCommands @ Compositor.js:198
update @ UIManager.js:154
step @ RequestAnimationFrameLoop.js:252
loop @ RequestAnimationFrameLoop.js:268
_looper @ RequestAnimationFrameLoop.js:81
```
To be clear, I'm not using NEED_SIZE_FOR anywhere myself :) And I did note in the ChangeLog (yay!) that this was meant to be removed entirely with https://github.com/Famous/engine/commit/30aa14d1dc40f6411417d807d2dc72f5b5db0ecc but got added back in with https://github.com/Famous/engine/commit/35c6db1bd2dab6cbc5ea6b395d737630399e9df7 possibly due to merging?
cc: @alexanderGugel, @michaelobriena, @DnMllr
Contributor guide
Assessment
This issue has not been assessed yet.