Famous / Famous/engine

[BUG?] Paths not being tracked properly

Open
#487 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.7k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

When we try to add a Node to a parent Node a second time, we expect an error like this, as in

``` js
var logo = scene.addChild();
scene.addChild(logo);
```

, we expect an error like this:

```
Uncaught Error: Node is already mounted at: body/0
```

However, I've got some complex code that is removing and adding child nodes often, and at some point, when I use `Node#addChild` to add a Node to a parent Node, I'm getting this error from PathStore instead:

```
Uncaught Error: item already exists at path: [data-reactid=".0"][data-scene-id="1"]/0/97/0/0/0/0/0/1
```

The "item" in question happens to be a Transform who's path is being (re)added `TransformSystem#registerTransformAtPath`, based on the stack trace:

```
ncaught Error: item already exists at path: [data-reactid=".0"][data-scene-id="1"]/0/97/0/0/0/0/0/1
at PathStore.insert (http://localhost:3000/client/lib/_famous/famous.entry.js?bab126b262ed37f8bcf79944013b074b89476f49:2117:16)
at TransformSystem.registerTransformAtPath (http://localhost:3000/client/lib/_famous/famous.entry.js?bab126b262ed37f8bcf79944013b074b89476f49:240:21)
at Node.mount (http://localhost:3000/client/lib/_famous/famous.entry.js?bab126b262ed37f8bcf79944013b074b89476f49:3503:26)
at Dispatch.mount (http://localhost:3000/client/lib/_famous/famous.entry.js?bab126b262ed37f8bcf79944013b074b89476f49:1644:64)
at Node.mount (http://localhost:3000/client/lib/_famous/famous.entry.js?bab126b262ed37f8bcf79944013b074b89476f49:3512:15)
at Dispatch.mount (http://localhost:3000/client/lib/_famous/famous.entry.js?bab126b262ed37f8bcf79944013b074b89476f49:1644:64)
at Node.mount (http://localhost:3000/client/lib/_famous/famous.entry.js?bab126b262ed37f8bcf79944013b074b89476f49:3512:15)
at Dispatch.mount (http://localhost:3000/client/lib/_famous/famous.entry.js?bab126b262ed37f8bcf79944013b074b89476f49:1644:64)
at Node.mount (http://localhost:3000/client/lib/_famous/famous.entry.js?bab126b262ed37f8bcf79944013b074b89476f49:3512:15)
at Dispatch.mount (http://localhost:3000/client/lib/_famous/famous.entry.js?bab126b262ed37f8bcf79944013b074b89476f49:1644:64)
```

This leads me to believe that the path system might have a bug because I'm strictly using only `Node#addChild`/`Node#removeChild`. At some points between those calls I'm adding and removing Position and Rotation components.

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.