
Hello Roll20.
I just discovered that any usages of null coalescing in a sheet worker will make the API Console throw an error.
Here is a minimum working example:
Steps to reproduce
- Create a new game, with a Custom Character Sheet Template
- Add the following HTML to the HTML Layout tab:
<script type="text/worker"> function helloWorld(name) { let test = name?.toLowerCase(); } </script>
- Click Save Changes
- Goto the API Console
- Add any API Script. (I tested with the Ammo script)
- Click Restart API Sandbox and open the game to see the following error:
Spinning up new sandbox... "Loading character sheet data..." "Starting webworker script..." "Loading 0 translation strings to worker..." "-=> Ammo v0.3.11 <=- [Fri Jun 12 2020 13:48:05 GMT+0000 (Coordinated Universal Time)]" "SyntaxError: Unexpected token '.'" "SyntaxError: Unexpected token '.' at eval (<anonymous>) at messageHandler (evalmachine.<anonymous>:713:6) at process.<anonymous> (/home/node/d20-api-server/node_modules/tiny-worker/lib/worker.js:65:55) at process.emit (events.js:310:20) at emit (internal/child_process.js:876:12) at processTicksAndRejections (internal/process/task_queues.js:85:21)"
It seems like the code that parses sheetworker code, expects the question mark to be the ternary operator( isTrue ? true : false )
instead of null coalescing (someAttribute?.someValue).
If you write sheetworkers. Watch out for this one!