kano-code icon indicating copy to clipboard operation
kano-code copied to clipboard

Parts can be renamed to match toolbox categories

Open keithclark opened this issue 5 years ago • 2 comments
trafficstars

If you rename a part to a name that already exists in the toolbox (i.e. Math) it:

  • Breaks the toolbox UI for the Math item.
  • Breaks any code relying on Math blocks (e.g Lerp) because the functions now appear to map the newly renamed part, which doesn’t have a Lerp block.

keithclark avatar Jan 12 '20 23:01 keithclark

Thanks for bringing this up. We should prevent using names from the core library to avoid this.

pazdera avatar Jan 15 '20 18:01 pazdera

Ran into this again but this time with variables. While testing something I created a variable named time. For some reason the creation stopped working. Opening devtools reveled the following JavaScript error.

VM374:20 Uncaught TypeError: time.every is not a function
    at eval (eval at runInContext (index-7728810b.js:1), <anonymous>:20:8)
    at t.fire (emitter-0ed5874e.js:1)
    at ApplicationModule._start (index-7728810b.js:1)
    at ApplicationModule.executeLifecycleStep (index-7728810b.js:1)
    at index-7728810b.js:1
    at Array.forEach (<anonymous>)
    at AppModules._runModuleLifecycleStep (index-7728810b.js:1)
    at AppModules.afterRun (index-7728810b.js:1)
    at Runner._onRunningStateChange (index-7728810b.js:1)
    at index-7728810b.js:1

My variable overwrites with the time object used in the output JavaScript. This is what was produced by the editor:

var time;

time.every(1, 'frames', function() {
  ...
})

keithclark avatar Jan 31 '20 00:01 keithclark