Skip to content

createScene on same selector as an old dismounted (but not removed) Scene -> Node is not mounted #330

@gadicc

Description

@gadicc

Given:

var FamousEngine = require('famous/core/FamousEngine');
var DOMElement = require('famous/dom-renderables/DOMElement');

var clock = FamousEngine.getClock();
FamousEngine.init();

var scene1 = FamousEngine.createScene('body');
scene1.dismount();

var scene2 = FamousEngine.createScene('body');

I get:

Uncaught Error: Node is not mounted
   dismount @ bundle.js:2880
   createScene @ bundle.js:1544

That's here:

FamousEngine.prototype.createScene = function createScene (selector) {
    selector = selector || 'body';

    if (this._scenes[selector]) this._scenes[selector].dismount(); // <---
    this._scenes[selector] = new Scene(selector, this);
    return this._scenes[selector];
};

So I guess the ref isn't cleaned up properly on dismount. Is this Scene.dismount()'s responsibility though? I don't recall if it's a new method or not, but calling FamousEngine.removeScene(scene1); works as expected.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions