fix(admin): avoid duplicate platform key in route target normalization

Merging the blank target and stored target before normalizing the
platform keeps the bundler from inlining blankTarget() into the same
object literal, which emitted a duplicate-object-key warning.
This commit is contained in:
RhenCloud committed 2026-09-26 16:23:00 +08:00
1 parent 05ede2aa03
commit 968ad3d2f3
1 file changed
+8 -10
+8 -10
View File
@@ -284,16 +284,14 @@ watch(
form.discordRolesText = r?.discordRoleIds?.length ? r.discordRoleIds.join(", ") : "";
form.targets =
r && r.targets.length
? r.targets.map((tg) => ({
...blankTarget(),
...tg,
platform:
tg.platform === "telegram"
? "telegram"
: tg.platform === "feishu"
? "feishu"
: "discord",
}))
? r.targets.map((tg) => {
const merged = { ...blankTarget(), ...tg };
merged.platform =
merged.platform === "telegram" || merged.platform === "feishu"
? merged.platform
: "discord";
return merged;
})
: [blankTarget()];
if (r?.ast) {
root.value = nodeToForm(r.ast);