alireza0:Shop v0.1.2 修复内置文本 vars 为 null 导致编辑器崩溃

Shop 服务端曾把无变量文本的 vars 编码为 null,104 条内置文本因此让编辑器在 .length 处崩溃。修复后统一发送 [],并新增内置文本和 /api/templates 两项测试;问题已在 v0.1.2 修复,更新后可移除 Local Override。

作者原文

Thanks for the detailed report, and for tracking it down to the exact expression. That saved a lot of time.

The bug is on the server side, not in the editor. When Shop builds the list of bot texts, each text's variable list started out empty in a way that Go encodes as null instead of []. Every text that uses no variable was therefore sent with "vars": null. That is 104 of the built-in texts, agent.label among them. The editor expects a list, so it crashed on .length.

The fix makes the server always send a list ([] for a text with no variables), so every text opens normally. Two tests now guard it: one checks every built-in text, and one checks the /api/templates response the editor reads.

It is fixed in v0.1.2: https://github.com/nx-panel/shop/releases/tag/v0.1.2. Once you update, you can drop the Local Override. Closing this; feel free to reopen if anything still misbehaves.