playcanvas / editor

Issue tracker for the PlayCanvas Editor
https://playcanvas.com/
154 stars 28 forks source link

Editor crashes when a state is added and the name is immediately changed #703

Closed yaustar closed 1 year ago

yaustar commented 2 years ago

Project: https://playcanvas.com/project/893632

Repro steps

Callstack:

TypeError: Cannot read properties of null (reading 'asset')
    at Observer.entity (editor.js:49059:102)
    at Observer.Events.emit (observer.js:107:31)
    at Observer._prepare (observer.js:428:18)
    at Observer.set (observer.js:510:28)
    at Function.updateAnimationAssetName (editor.js:81222:22)
    at editor.js:80031:58
    at ObserverList.forEach (observer.js:1425:13)
    at Object.redo (editor.js:80029:45)
    at AnimstategraphView._onUpdateNodeAttribute (editor.js:80054:24)
    at HTMLDivElement.<anonymous> (pcui-graph.js:46099:11)
    at HTMLDivElement.sentryWrapped (bundle.min.js:2:51939)
    at Graph._dispatchEvent (pcui-graph.js:46104:18)
    at Graph._onNodeAttributeUpdated (pcui-graph.js:45816:14)
    at TextInput.<anonymous> (pcui-graph.js:43743:17)
    at TextInput.Events.emit (observer.js:107:31)
    at TextInput._onInputChange (pcui-external.js:929:18)
    at HTMLInputElement.sentryWrapped (bundle.min.js:2:51939)
    at TextInput._onInputKeyDown (pcui-external.js:954:32)
    at HTMLInputElement.sentryWrapped (bundle.min.js:2:51939)
15:01:42.043 instrument.ts:129 *:set (event error)
15:01:42.043 instrument.ts:129 TypeError: Cannot read properties of null (reading 'asset')
    at Observer.entity (editor.js:49059:102)
    at Observer.Events.emit (observer.js:107:31)
    at Observer._prepare (observer.js:428:18)
    at Observer.set (observer.js:510:28)
    at Function.updateAnimationAssetName (editor.js:81222:22)
    at editor.js:80031:58
    at ObserverList.forEach (observer.js:1425:13)
    at Object.redo (editor.js:80029:45)
    at AnimstategraphView._onUpdateNodeAttribute (editor.js:80054:24)
    at HTMLDivElement.<anonymous> (pcui-graph.js:46099:11)
    at HTMLDivElement.sentryWrapped (bundle.min.js:2:51939)
    at Graph._dispatchEvent (pcui-graph.js:46104:18)
    at Graph._onNodeAttributeUpdated (pcui-graph.js:45816:14)
    at TextInput.<anonymous> (pcui-graph.js:43743:17)
    at TextInput.Events.emit (observer.js:107:31)
    at TextInput._onInputChange (pcui-external.js:929:18)
    at HTMLInputElement.sentryWrapped (bundle.min.js:2:51939)
    at TextInput._onInputKeyDown (pcui-external.js:954:32)
    at HTMLInputElement.sentryWrapped (bundle.min.js:2:51939)
15:01:42.398 instrument.ts:129 Error: invalid:null
    at wrapErrorData (editor.js:25056:13)
    at Connection.handleMessage (editor.js:24984:11)
    at socket.onmessage (editor.js:24935:18)
    at WebSocket._socket.onmessage (api.js:4517:13)

https://user-images.githubusercontent.com/16639049/157048037-dbefd735-4e89-4b5b-a179-37189c581882.mp4

If you deselect and reselect the state that was just created, the crash does not happen

https://user-images.githubusercontent.com/16639049/157048378-384b104e-5fdf-4570-9b26-dce678b1721b.mp4

ellthompson commented 1 year ago

Closing this issue as it can no longer be reproduced on production.