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:
@@ -343,17 +343,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cb) {
|
if (cb) {
|
||||||
cb(JSON.parse(JSON.stringify(res)));
|
cb(structuredClone(res));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (cb) {
|
if (cb) {
|
||||||
cb(
|
cb({ error: 'Tool Server Not Found' });
|
||||||
JSON.parse(
|
|
||||||
JSON.stringify({
|
|
||||||
error: 'Tool Server Not Found'
|
|
||||||
})
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user