blockly produce id with back tick `

34 views
Skip to first unread message

fajar rokhman

unread,
Nov 4, 2024, 6:35:04 PM11/4/24
to Blockly
HI,

this is a random issue, but happens often on me.

blockly produce id with random string that sometimes contains a  back tick(`)
this break my javascript application.

is this intentional?


Aaron Dodson

unread,
Nov 4, 2024, 6:40:43 PM11/4/24
to Blockly
Hi,

Yes, backticks are part of the character set that Blockly uses to generate IDs. If the ID is treated as a string, this should work fine; situations where it breaks things typically indicate that values are being interpolated, eval'ed, or otherwise being handled oddly. If you're able to share the error you're running into and/or the code in question we might be able to give you some pointers.

- Aaron

fajar rokhman

unread,
Nov 5, 2024, 5:20:43 AM11/5/24
to Blockly
I follow the guide here:
https://developers.google.com/blockly/guides/app-integration/running-javascript#highlight_blocks

A backtick is a javascript-reserved word used to create a template string. When the ID has a backtick, the code will break.

I can encode and decode the ID manually. But I think it is better to remove the backtick from ID.

Neil Fraser

unread,
Nov 5, 2024, 9:28:36 AM11/5/24
to blo...@googlegroups.com
Am Di., 5. Nov. 2024 um 11:20 Uhr schrieb fajar rokhman <rokhma...@gmail.com>:
I follow the guide here:
https://developers.google.com/blockly/guides/app-integration/running-javascript#highlight_blocks

A backtick is a javascript-reserved word used to create a template string. When the ID has a backtick, the code will break.

I can encode and decode the ID manually. But I think it is better to remove the backtick from ID.

--
Neil Fraser, Switzerland
https://neil.fraser.name
Reply all
Reply to author
Forward
0 new messages