Khan / Khan/live-editor

colorMode(HSB) causes error after Restart button clicked in some projects

Open
#587 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
776
Forks
180
PR merge metrics
No merged PRs in 30d

Description

Reported on ZenDesk... User is getting `Cannot read property 0 of undefined!` only after a restart in this program: https://www.khanacademy.org/computer-programming/new-program/6028718145
reproduced, confirmed... they're saying it's happening as a result of `colorMode(HSB);` on line 68, commenting it out fixes it... I can confirm this as well and have reproduced in both Chrome and Firefox.

Browser console reveals that the error is occurring here (in the minified code, see commented line). This definitely seems to go along with the thought that `colorMode(HSB)` has something to do with it.

https://cdn.kastatic.org/genfiles/javascript/en/scratchpads-exec-pjs-package-e05176.js line 1190

```
function Wr(e,t,r,i){var a,s,o,l
if(dt===p.HSB){var u=v.color.toRGB(e,t,r)
a=u[0] // Uncaught TypeError: Cannot read property '0' of undefined
s=u[1]
```

I don't have any simpler code for reproduction yet than the learner's project, will update if that changes.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the linked learner project by clicking Restart after running colorMode(HSB). Inspect the reported generated script at line 1190 and trace the error back to the live-editor source; done means restarting the project no longer raises the undefined-value error in Chrome and Firefox.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.