Famous / Famous/engine

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

Open
#330 8 comments 0 reactions 1 assignee Claimed by @alexanderGugel View on GitHub
Dominant language
JavaScript
Stars
1.7k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

Given:

``` js
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:

``` js
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.