perf: replace JSON.parse(JSON.stringify()) with structuredClone in layout (#22104)

Replace JSON roundtrip with native structuredClone for tool execution result cloning. Also remove unnecessary JSON roundtrip on a static error object literal that is already a fresh value.
This commit is contained in:
Classic298 2026-03-01 19:36:16 +01:00 • committed by GitHub
parent 6d7f21b57b
commit 391a4878e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -343,17 +343,11 @@
}
if (cb) {
cb(JSON.parse(JSON.stringify(res)));
cb(structuredClone(res));
}
} else {
if (cb) {
cb(
JSON.parse(
JSON.stringify({
error: 'Tool Server Not Found'
})
)
);
cb({ error: 'Tool Server Not Found' });
}
}
};