@sentry/nextjs
Version:
Official Sentry SDK for Next.js
25 lines (22 loc) • 740 B
JavaScript
const commonMap = new WeakMap();
/**
* Takes a shared (garbage collectable) object between resources, e.g. a headers object shared between Next.js server components and returns a common propagation context.
*/
function commonObjectToPropagationContext(
commonObject,
propagationContext,
) {
if (typeof commonObject === 'object' && commonObject) {
const memoPropagationContext = commonMap.get(commonObject);
if (memoPropagationContext) {
return memoPropagationContext;
} else {
commonMap.set(commonObject, propagationContext);
return propagationContext;
}
} else {
return propagationContext;
}
}
export { commonObjectToPropagationContext };
//# sourceMappingURL=commonObjectTracing.js.map