deepMerge mutates both arguments instead of returning a new object.
Still present on main.
// deepMerge as generated in src/api/<client>/utils.ts
function deepMerge(target, source) {
const returnType = target || {};
for (const key in source) {
if (source[key] instanceof Object)
Object.assign(source[key], deepMerge(returnType[key], source[key]));
}
Object.assign(returnType || {}, source);
return returnType;
}
const fetcherOptions = {}; // shared per hook instance
const send = (variables) => deepMerge(fetcherOptions, variables);
send({ body: { title: 'Fleet', archivedAt: '2026-01-01' } });
send({ body: { title: 'Costs' } });
// sends { title: 'Costs', archivedAt: '2026-01-01' } — stale field leaked
The bug can be replicated using the generated (request query hooks) code like so:
export function DeepMergeDemoScreen() {
const { mutateAsync: createDashboard, isPending } = useCreateDashboard();
const onRun = async () => {
await Promise.all(
['Demo A', 'Demo B', 'Demo C'].map((title) =>
createDashboard({
body: { title },
}),
),
);
};
return (
<button onClick={onRun}>
{isPending ? 'Creating…' : 'Create 3 dashboards at once'}
</button>
);
}
In the example above the request body payload is incorrect for some of the requests.
deepMergemutates both arguments instead of returning a new object.Still present on
main.The bug can be replicated using the generated (request query hooks) code like so:
In the example above the request body payload is incorrect for some of the requests.