Files
patchy631--ai-engineering-hub/open-agent-builder/components/providers/BigIntProvider.tsx
T
2026-07-13 12:37:47 +08:00

24 lines
585 B
TypeScript

'use client';
import { useEffect } from 'react';
/**
* BigInt Serialization Provider
*
* Adds global JSON.stringify support for BigInt values.
* Required for Next.js 16 beta + React 19 compatibility.
*/
export function BigIntProvider({ children }: { children: React.ReactNode }) {
useEffect(() => {
// Add BigInt serialization support globally
if (typeof BigInt !== 'undefined') {
// @ts-ignore - Adding toJSON to BigInt prototype
BigInt.prototype.toJSON = function() {
return this.toString();
};
}
}, []);
return <>{children}</>;
}