janpaul123 / paperprograms

Run Javascript on pieces of paper!

Home Page:https://paperprograms.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Duplicate react keys cause exception when program requests multiple canvases

paulsonnentag opened this issue · comments

I found a bug when requesting multiple canvases like this:

 var canvas2 = await paper.get('canvas');
 var canvas = await paper.get('canvas', { number: 42 }); // some other paper number

I get the following errror

screen shot 2018-04-26 at 16 44 39

The cause is that the canvases have duplicate keys which leads to bugy behaviour.

screen shot 2018-04-26 at 16 32 06

Interestingly it works when requesting the canvases the other way around:

 var canvas = await paper.get('canvas', { number: 42 }); // some other paper number
 var canvas2 = await paper.get('canvas');

I've fixed the issue by generating unique keys.