From e825f0d1bb6283d90b40d43d01f4de7278df4cf0 Mon Sep 17 00:00:00 2001 From: lucas Date: Tue, 3 Feb 2026 19:11:49 +0000 Subject: [PATCH 1/2] comment setAttribute scope and add warn log --- packages/core/src/js/scopeSync.ts | 33 ++++++++++++++++------------ packages/core/test/scopeSync.test.ts | 3 +++ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/packages/core/src/js/scopeSync.ts b/packages/core/src/js/scopeSync.ts index 1fe6b65265..0bfd05186a 100644 --- a/packages/core/src/js/scopeSync.ts +++ b/packages/core/src/js/scopeSync.ts @@ -1,4 +1,5 @@ import type { Breadcrumb, Scope } from '@sentry/core'; +import { debug } from '@sentry/core'; import { logger } from '@sentry/react'; import { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb'; import { fillTyped } from './utils/fill'; @@ -81,26 +82,30 @@ export function enableSyncToNative(scope: Scope): void { }); fillTyped(scope, 'setAttribute', original => (key: string, value: unknown): Scope => { + debug.warn('This feature is currently not supported.'); // Only sync primitive types - if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { - NATIVE.setAttribute(key, value); - } + // Native layer still not supported + // if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + // NATIVE.setAttribute(key, value); + // } return original.call(scope, key, value); }); fillTyped(scope, 'setAttributes', original => (attributes: Record): Scope => { + // Native layer not supported + debug.warn('This feature is currently not supported.'); // Filter to only primitive types - const primitiveAttrs: Record = {}; - Object.keys(attributes).forEach(key => { - const value = attributes[key]; - if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { - primitiveAttrs[key] = value; - } - }); - - if (Object.keys(primitiveAttrs).length > 0) { - NATIVE.setAttributes(primitiveAttrs); - } + // const primitiveAttrs: Record = {}; + // Object.keys(attributes).forEach(key => { + // const value = attributes[key]; + // if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + // primitiveAttrs[key] = value; + // } + // }); + // + // if (Object.keys(primitiveAttrs).length > 0) { + // NATIVE.setAttributes(primitiveAttrs); + // } return original.call(scope, attributes); }); } diff --git a/packages/core/test/scopeSync.test.ts b/packages/core/test/scopeSync.test.ts index 43a8146648..902d97ccf9 100644 --- a/packages/core/test/scopeSync.test.ts +++ b/packages/core/test/scopeSync.test.ts @@ -219,6 +219,8 @@ describe('ScopeSync', () => { expect(setContextScopeSpy).toHaveBeenCalledExactlyOnceWith('key', { key: 'value' }); }); + /* + TODO: uncomment tests once native implementation is done. it('setAttribute', () => { expect(SentryCore.getIsolationScope().setAttribute).not.toBe(setAttributeScopeSpy); @@ -283,5 +285,6 @@ describe('ScopeSync', () => { }); expect(NATIVE.setAttributes).not.toHaveBeenCalled(); }); + */ }); }); From b4b0a2eaa883276471907a61d34e84c4da3416d3 Mon Sep 17 00:00:00 2001 From: lucas Date: Tue, 3 Feb 2026 19:42:29 +0000 Subject: [PATCH 2/2] lint fix --- packages/core/test/scopeSync.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/test/scopeSync.test.ts b/packages/core/test/scopeSync.test.ts index 902d97ccf9..c1da1841ba 100644 --- a/packages/core/test/scopeSync.test.ts +++ b/packages/core/test/scopeSync.test.ts @@ -116,8 +116,11 @@ describe('ScopeSync', () => { let setExtrasScopeSpy: jest.SpyInstance; let addBreadcrumbScopeSpy: jest.SpyInstance; let setContextScopeSpy: jest.SpyInstance; + /* + TODO: Uncomment once Native setattribute is implemented. let setAttributeScopeSpy: jest.SpyInstance; let setAttributesScopeSpy: jest.SpyInstance; + */ beforeAll(() => { const testScope = SentryCore.getIsolationScope();