-
Notifications
You must be signed in to change notification settings - Fork 55
Description
ref: adam on instagram
gui TypeError: Cannot create property 'onclose' on boolean 'true'
at CloudProvider.value (gui.min.js:1)
at n.value (gui.min.js:1)
at n.value (gui.min.js:1)
at n.e (lib.min.js:12)
at n.r.emit (lib.min.js:24)
at t.<anonymous> (lib.min.js:157)
at t.r.emit (lib.min.js:24)
at t.value (lib.min.js:83)
at n.value (lib.min.js:157)
at n.value (lib.min.js:157)This sets connection to true, which is all fine and dandy because _openConnection isn't called so no properties are being set on it (reading properties of true is fine though).
scratch-gui/src/lib/cloud-provider.js
Line 45 in b466e09
| this.connection = true; |
However, there are two cases where properties will still get set on true. When changing the cloud IP via special cloud behaviours:
scratch-gui/src/lib/cloud-provider.js
Lines 267 to 271 in b466e09
| if (this.connection) { | |
| this.connection.onclose = () => {}; | |
| this.connection.onerror = () => {}; | |
| this.connection.close(); | |
| } |
and when closing the connection:
scratch-gui/src/lib/cloud-provider.js
Lines 357 to 365 in b466e09
| if (this.connection && | |
| this.connection.readyState !== WebSocket.CLOSING && | |
| this.connection.readyState !== WebSocket.CLOSED) { | |
| log.info('Request close cloud connection without reconnecting'); | |
| // Remove listeners, after this point we do not want to react to connection updates | |
| this.connection.onclose = () => {}; | |
| this.connection.onerror = () => {}; | |
| this.connection.close(); | |
| } |
The latter only happens when there's already a project using cloud variables, so when you load a new project, I guess it first requests to close the connection, and an error is thrown preventing the new project from loading
And of course, this requires that the cloud host remains unset