@datadog/mobile-react-native 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +4 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +6 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdLogs.kt +162 -6
- package/android/src/main/kotlin/com/datadog/reactnative/DdRum.kt +9 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +4 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +5 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +4 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdLogsTest.kt +242 -2
- package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +10 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +6 -2
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +2 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/GenericAssert.kt +2 -2
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +3 -1
- package/ios/Sources/Attributes.swift +7 -0
- package/ios/Sources/DdLogs.m +31 -0
- package/ios/Sources/DdLogs.swift +84 -4
- package/ios/Sources/DdRum.m +3 -0
- package/ios/Sources/DdRum.swift +7 -0
- package/ios/Sources/DdSdk.swift +2 -0
- package/ios/Sources/DdSdkConfiguration.swift +7 -1
- package/ios/Sources/RNDdSdkConfiguration.swift +5 -1
- package/lib/commonjs/DdSdkReactNative.js +5 -1
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/InternalLog.js +6 -2
- package/lib/commonjs/InternalLog.js.map +1 -1
- package/lib/commonjs/errorUtils.js +20 -1
- package/lib/commonjs/errorUtils.js.map +1 -1
- package/lib/commonjs/logs/DdLogs.js +102 -11
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/logs/eventMapper.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +6 -0
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +60 -46
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +2 -2
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +9 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
- package/lib/commonjs/rum/types.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +5 -1
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/InternalLog.js +2 -1
- package/lib/module/InternalLog.js.map +1 -1
- package/lib/module/errorUtils.js +15 -0
- package/lib/module/errorUtils.js.map +1 -1
- package/lib/module/logs/DdLogs.js +103 -12
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/logs/eventMapper.js.map +1 -1
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/DdRum.js +5 -0
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +61 -46
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +2 -2
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +9 -1
- package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
- package/lib/module/rum/types.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/InternalLog.d.ts +1 -0
- package/lib/typescript/errorUtils.d.ts +2 -0
- package/lib/typescript/logs/DdLogs.d.ts +13 -5
- package/lib/typescript/logs/eventMapper.d.ts +5 -5
- package/lib/typescript/logs/types.d.ts +34 -8
- package/lib/typescript/nativeModulesTypes.d.ts +44 -4
- package/lib/typescript/rum/DdRum.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +3 -2
- package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts +5 -2
- package/lib/typescript/rum/types.d.ts +4 -0
- package/lib/typescript/types.d.ts +4 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNative.tsx +6 -1
- package/src/InternalLog.tsx +3 -1
- package/src/__tests__/errorUtils.test.ts +49 -0
- package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +14 -14
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +452 -109
- package/src/__tests__/rum/instrumentation/ShallowObjectEqualityChecker.test.ts +18 -0
- package/src/errorUtils.ts +15 -0
- package/src/logs/DdLogs.ts +166 -16
- package/src/logs/__tests__/DdLogs.test.ts +169 -0
- package/src/logs/__tests__/eventMapper.test.ts +34 -0
- package/src/logs/eventMapper.ts +15 -4
- package/src/logs/types.ts +36 -8
- package/src/nativeModulesTypes.ts +73 -4
- package/src/rum/DdRum.ts +5 -0
- package/src/rum/__tests__/DdRum.test.ts +12 -27
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +41 -10
- package/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.tsx +7 -4
- package/src/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.ts +11 -3
- package/src/rum/types.ts +5 -0
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +2 -0
- package/src/types.tsx +2 -0
- package/src/version.ts +1 -1
|
@@ -74,32 +74,96 @@ export type DdNativeSdkType = {
|
|
|
74
74
|
*/
|
|
75
75
|
export type DdNativeLogsType = {
|
|
76
76
|
/**
|
|
77
|
-
* Send a log with level
|
|
77
|
+
* Send a log with DEBUG level.
|
|
78
78
|
* @param message: The message to send.
|
|
79
79
|
* @param context: The additional context to send.
|
|
80
80
|
*/
|
|
81
81
|
debug(message: string, context?: object): Promise<void>;
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
-
* Send a log with level
|
|
84
|
+
* Send a log with INFO level.
|
|
85
85
|
* @param message: The message to send.
|
|
86
86
|
* @param context: The additional context to send.
|
|
87
87
|
*/
|
|
88
88
|
info(message: string, context?: object): Promise<void>;
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
* Send a log with level
|
|
91
|
+
* Send a log with WARN level.
|
|
92
92
|
* @param message: The message to send.
|
|
93
93
|
* @param context: The additional context to send.
|
|
94
94
|
*/
|
|
95
95
|
warn(message: string, context?: object): Promise<void>;
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* Send a log with level
|
|
98
|
+
* Send a log with ERROR level.
|
|
99
99
|
* @param message: The message to send.
|
|
100
100
|
* @param context: The additional context to send.
|
|
101
101
|
*/
|
|
102
102
|
error(message: string, context?: object): Promise<void>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Send a log containing an error with DEBUG level.
|
|
106
|
+
* @param message: The message to send.
|
|
107
|
+
* @param errorKind: The error kind to send.
|
|
108
|
+
* @param errorMessage: The error message to send.
|
|
109
|
+
* @param stacktrace: The stack trace to send.
|
|
110
|
+
* @param context: The additional context to send.
|
|
111
|
+
*/
|
|
112
|
+
debugWithError(
|
|
113
|
+
message: string,
|
|
114
|
+
errorKind?: string,
|
|
115
|
+
errorMessage?: string,
|
|
116
|
+
stacktrace?: string,
|
|
117
|
+
context?: object
|
|
118
|
+
): Promise<void>;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Send a log containing an error with INDO level.
|
|
122
|
+
* @param message: The message to send.
|
|
123
|
+
* @param errorKind: The error kind to send.
|
|
124
|
+
* @param errorMessage: The error message to send.
|
|
125
|
+
* @param stacktrace: The stack trace to send.
|
|
126
|
+
* @param context: The additional context to send.
|
|
127
|
+
*/
|
|
128
|
+
infoWithError(
|
|
129
|
+
message: string,
|
|
130
|
+
errorKind?: string,
|
|
131
|
+
errorMessage?: string,
|
|
132
|
+
stacktrace?: string,
|
|
133
|
+
context?: object
|
|
134
|
+
): Promise<void>;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Send a log containing an error with WARN level.
|
|
138
|
+
* @param message: The message to send.
|
|
139
|
+
* @param errorKind: The error kind to send.
|
|
140
|
+
* @param errorMessage: The error message to send.
|
|
141
|
+
* @param stacktrace: The stack trace to send.
|
|
142
|
+
* @param context: The additional context to send.
|
|
143
|
+
*/
|
|
144
|
+
warnWithError(
|
|
145
|
+
message: string,
|
|
146
|
+
errorKind?: string,
|
|
147
|
+
errorMessage?: string,
|
|
148
|
+
stacktrace?: string,
|
|
149
|
+
context?: object
|
|
150
|
+
): Promise<void>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Send a log containing an error with ERROR level.
|
|
154
|
+
* @param message: The message to send.
|
|
155
|
+
* @param errorKind: The error kind to send.
|
|
156
|
+
* @param errorMessage: The error message to send.
|
|
157
|
+
* @param stacktrace: The stack trace to send.
|
|
158
|
+
* @param context: The additional context to send.
|
|
159
|
+
*/
|
|
160
|
+
errorWithError(
|
|
161
|
+
message: string,
|
|
162
|
+
errorKind?: string,
|
|
163
|
+
errorMessage?: string,
|
|
164
|
+
stacktrace?: string,
|
|
165
|
+
context?: object
|
|
166
|
+
): Promise<void>;
|
|
103
167
|
};
|
|
104
168
|
|
|
105
169
|
/**
|
|
@@ -258,6 +322,11 @@ export type DdNativeRumType = {
|
|
|
258
322
|
* @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.
|
|
259
323
|
*/
|
|
260
324
|
addTiming(name: string): Promise<void>;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Stops the current RUM Session.
|
|
328
|
+
*/
|
|
329
|
+
stopSession(): Promise<void>;
|
|
261
330
|
};
|
|
262
331
|
|
|
263
332
|
type ActionType = 'TAP' | 'SCROLL' | 'SWIPE' | 'BACK' | 'CUSTOM';
|
package/src/rum/DdRum.ts
CHANGED
|
@@ -326,6 +326,11 @@ class DdRumWrapper implements DdRumType {
|
|
|
326
326
|
return bufferVoidNativeCall(() => this.nativeRum.addTiming(name));
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
+
stopSession(): Promise<void> {
|
|
330
|
+
InternalLog.log('Stopping RUM Session', SdkVerbosity.DEBUG);
|
|
331
|
+
return bufferVoidNativeCall(() => this.nativeRum.stopSession());
|
|
332
|
+
}
|
|
333
|
+
|
|
329
334
|
registerErrorEventMapper(errorEventMapper: ErrorEventMapper) {
|
|
330
335
|
this.errorEventMapper = generateErrorEventMapper(errorEventMapper);
|
|
331
336
|
}
|
|
@@ -24,12 +24,12 @@ jest.mock('../../TimeProvider', () => {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
describe('DdRum', () => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
jest.clearAllMocks();
|
|
29
|
+
BufferSingleton.onInitialization();
|
|
30
|
+
});
|
|
32
31
|
|
|
32
|
+
describe('DdRum.stopAction', () => {
|
|
33
33
|
test('calls the native SDK when called with new API', async () => {
|
|
34
34
|
await DdRum.stopAction('scroll', 'page', { user: 'me' }, 123);
|
|
35
35
|
expect(NativeModules.DdRum.stopAction).toHaveBeenCalledWith(
|
|
@@ -151,11 +151,6 @@ describe('DdRum', () => {
|
|
|
151
151
|
});
|
|
152
152
|
|
|
153
153
|
describe('DdRum.addError', () => {
|
|
154
|
-
beforeEach(() => {
|
|
155
|
-
jest.clearAllMocks();
|
|
156
|
-
DdRum.unregisterErrorEventMapper();
|
|
157
|
-
});
|
|
158
|
-
|
|
159
154
|
it('registers event mapper and maps error', async () => {
|
|
160
155
|
const errorEventMapper: ErrorEventMapper = error => {
|
|
161
156
|
error.message = 'New message';
|
|
@@ -196,12 +191,6 @@ describe('DdRum', () => {
|
|
|
196
191
|
});
|
|
197
192
|
|
|
198
193
|
describe('DdRum.stopResource', () => {
|
|
199
|
-
beforeEach(() => {
|
|
200
|
-
jest.clearAllMocks();
|
|
201
|
-
DdRum.unregisterResourceEventMapper();
|
|
202
|
-
BufferSingleton.onInitialization();
|
|
203
|
-
});
|
|
204
|
-
|
|
205
194
|
it('registers event mapper and maps resource', async () => {
|
|
206
195
|
const resourceEventMapper: ResourceEventMapper = resource => {
|
|
207
196
|
resource.context = { retryAttempts: 3 };
|
|
@@ -270,11 +259,6 @@ describe('DdRum', () => {
|
|
|
270
259
|
});
|
|
271
260
|
|
|
272
261
|
describe('DdRum.addAction', () => {
|
|
273
|
-
beforeEach(() => {
|
|
274
|
-
jest.clearAllMocks();
|
|
275
|
-
DdRum.unregisterActionEventMapper();
|
|
276
|
-
});
|
|
277
|
-
|
|
278
262
|
it('registers event mapper and maps action', async () => {
|
|
279
263
|
const actionEventMapper: ActionEventMapper = action => {
|
|
280
264
|
action.context = { frustration: true };
|
|
@@ -318,12 +302,6 @@ describe('DdRum', () => {
|
|
|
318
302
|
});
|
|
319
303
|
|
|
320
304
|
describe('DdRum.stopAction', () => {
|
|
321
|
-
beforeEach(() => {
|
|
322
|
-
jest.clearAllMocks();
|
|
323
|
-
DdRum.unregisterActionEventMapper();
|
|
324
|
-
BufferSingleton.onInitialization();
|
|
325
|
-
});
|
|
326
|
-
|
|
327
305
|
it('registers event mapper and maps action', async () => {
|
|
328
306
|
const actionEventMapper: ActionEventMapper = action => {
|
|
329
307
|
action.context = { frustration: true };
|
|
@@ -384,6 +362,13 @@ describe('DdRum', () => {
|
|
|
384
362
|
});
|
|
385
363
|
});
|
|
386
364
|
|
|
365
|
+
describe('DdRum.stopSession', () => {
|
|
366
|
+
it('calls the native API', async () => {
|
|
367
|
+
await DdRum.stopSession();
|
|
368
|
+
expect(NativeModules.DdRum.stopSession).toHaveBeenCalledWith();
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
|
|
387
372
|
describe('PropagatorTypes', () => {
|
|
388
373
|
it('matches with the native name of propagators', () => {
|
|
389
374
|
/**
|
|
@@ -11,8 +11,11 @@ import { SdkVerbosity } from '../../SdkVerbosity';
|
|
|
11
11
|
import {
|
|
12
12
|
getErrorMessage,
|
|
13
13
|
getErrorStackTrace,
|
|
14
|
-
EMPTY_STACK_TRACE
|
|
14
|
+
EMPTY_STACK_TRACE,
|
|
15
|
+
getErrorName,
|
|
16
|
+
DEFAULT_ERROR_NAME
|
|
15
17
|
} from '../../errorUtils';
|
|
18
|
+
import { DdLogs } from '../../logs/DdLogs';
|
|
16
19
|
import { DdRum } from '../DdRum';
|
|
17
20
|
import { ErrorSource } from '../types';
|
|
18
21
|
|
|
@@ -63,11 +66,11 @@ export class DdRumErrorTracking {
|
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
static onGlobalError(error: any, isFatal?: boolean): void {
|
|
69
|
+
static onGlobalError = (error: any, isFatal?: boolean): void => {
|
|
68
70
|
const message = getErrorMessage(error);
|
|
69
71
|
const stacktrace = getErrorStackTrace(error);
|
|
70
|
-
|
|
72
|
+
const errorName = getErrorName(error);
|
|
73
|
+
this.reportError(message, ErrorSource.SOURCE, stacktrace, errorName, {
|
|
71
74
|
'_dd.error.is_crash': isFatal,
|
|
72
75
|
'_dd.error.raw': error
|
|
73
76
|
}).then(() => {
|
|
@@ -78,19 +81,32 @@ export class DdRumErrorTracking {
|
|
|
78
81
|
DdRumErrorTracking.isInDefaultErrorHandler = false;
|
|
79
82
|
}
|
|
80
83
|
});
|
|
81
|
-
}
|
|
84
|
+
};
|
|
82
85
|
|
|
83
|
-
static onConsoleError(...params: unknown[]): void {
|
|
86
|
+
static onConsoleError = (...params: unknown[]): void => {
|
|
84
87
|
if (DdRumErrorTracking.isInDefaultErrorHandler) {
|
|
85
88
|
return;
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
let stack: string = EMPTY_STACK_TRACE;
|
|
92
|
+
let errorName: string = DEFAULT_ERROR_NAME;
|
|
89
93
|
for (let i = 0; i < params.length; i += 1) {
|
|
90
94
|
const param = params[i];
|
|
95
|
+
|
|
91
96
|
const paramStack = getErrorStackTrace(param);
|
|
92
97
|
if (paramStack !== EMPTY_STACK_TRACE) {
|
|
93
98
|
stack = paramStack;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const paramErrorName = getErrorName(param);
|
|
102
|
+
if (paramErrorName !== DEFAULT_ERROR_NAME) {
|
|
103
|
+
errorName = paramErrorName;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (
|
|
107
|
+
errorName !== DEFAULT_ERROR_NAME &&
|
|
108
|
+
stack !== EMPTY_STACK_TRACE
|
|
109
|
+
) {
|
|
94
110
|
break;
|
|
95
111
|
}
|
|
96
112
|
}
|
|
@@ -105,8 +121,23 @@ export class DdRumErrorTracking {
|
|
|
105
121
|
})
|
|
106
122
|
.join(' ');
|
|
107
123
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
124
|
+
this.reportError(message, ErrorSource.CONSOLE, stack, errorName).then(
|
|
125
|
+
() => {
|
|
126
|
+
DdRumErrorTracking.defaultConsoleError.apply(console, params);
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
private static reportError = (
|
|
132
|
+
message: string,
|
|
133
|
+
source: ErrorSource,
|
|
134
|
+
stacktrace: string,
|
|
135
|
+
errorName: string,
|
|
136
|
+
context?: object
|
|
137
|
+
): Promise<[void, void]> => {
|
|
138
|
+
return Promise.all([
|
|
139
|
+
DdRum.addError(message, source, stacktrace, context),
|
|
140
|
+
DdLogs.error(message, errorName, message, stacktrace, context)
|
|
141
|
+
]);
|
|
142
|
+
};
|
|
112
143
|
}
|
|
@@ -19,9 +19,12 @@ const HANDLE_EVENT_APP_EXECUTION_TIME_IN_MS = 1;
|
|
|
19
19
|
const DD_ACTION_NAME_PROP = 'dd-action-name';
|
|
20
20
|
|
|
21
21
|
export class DdEventsInterceptor implements EventsInterceptor {
|
|
22
|
-
static
|
|
22
|
+
static ACTION_EVENT_DROPPED_DEBUG_MESSAGE =
|
|
23
23
|
'An action event was dropped because either the `onPress` method arguments' +
|
|
24
|
-
' were undefined or they were missing the target information.'
|
|
24
|
+
' were undefined or they were missing the target information.' +
|
|
25
|
+
' This log can happen if you use an abstraction component with an `onPress` prop' +
|
|
26
|
+
' that does not receive the native event is first argument.' +
|
|
27
|
+
' In this case, you can ignore this log.';
|
|
25
28
|
|
|
26
29
|
private debouncingStartedTimestamp = Number.MIN_VALUE;
|
|
27
30
|
|
|
@@ -40,8 +43,8 @@ export class DdEventsInterceptor implements EventsInterceptor {
|
|
|
40
43
|
}
|
|
41
44
|
} else {
|
|
42
45
|
InternalLog.log(
|
|
43
|
-
DdEventsInterceptor.
|
|
44
|
-
SdkVerbosity.
|
|
46
|
+
DdEventsInterceptor.ACTION_EVENT_DROPPED_DEBUG_MESSAGE,
|
|
47
|
+
SdkVerbosity.DEBUG
|
|
45
48
|
);
|
|
46
49
|
}
|
|
47
50
|
}
|
|
@@ -5,12 +5,20 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Does a shallow comparison between 2 objects
|
|
8
|
+
* Does a shallow comparison between 2 objects.
|
|
9
|
+
*
|
|
10
|
+
* In some rare cases, one of the objects can be `undefined` or `null`.
|
|
11
|
+
* This is documented in https://github.com/DataDog/dd-sdk-reactnative/issues/419.
|
|
9
12
|
*/
|
|
10
13
|
export const areObjectShallowEqual = (
|
|
11
|
-
objectA: Record<string, unknown
|
|
12
|
-
objectB: Record<string, unknown>
|
|
14
|
+
objectA: Record<string, unknown> | undefined | null,
|
|
15
|
+
objectB: Record<string, unknown> | undefined | null
|
|
13
16
|
): boolean => {
|
|
17
|
+
// Handle edge case when one object is `undefined` or `null`
|
|
18
|
+
if (!objectA || !objectB) {
|
|
19
|
+
return objectA === objectB;
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
const keys = Object.keys(objectA);
|
|
15
23
|
if (keys.length !== Object.keys(objectB).length) {
|
|
16
24
|
return false;
|
package/src/rum/types.ts
CHANGED
|
@@ -142,6 +142,11 @@ export type DdRumType = {
|
|
|
142
142
|
* @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.
|
|
143
143
|
*/
|
|
144
144
|
addTiming(name: string): Promise<void>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Stops the current RUM Session.
|
|
148
|
+
*/
|
|
149
|
+
stopSession(): Promise<void>;
|
|
145
150
|
};
|
|
146
151
|
|
|
147
152
|
/**
|
|
@@ -70,6 +70,8 @@ describe('DatadogProvider', () => {
|
|
|
70
70
|
"clientToken": "fakeToken",
|
|
71
71
|
"configurationForTelemetry": {
|
|
72
72
|
"initializationType": "SYNC",
|
|
73
|
+
"reactNativeVersion": "0.71.2",
|
|
74
|
+
"reactVersion": "18.2.0",
|
|
73
75
|
"trackErrors": true,
|
|
74
76
|
"trackInteractions": true,
|
|
75
77
|
"trackNetworkRequests": false,
|
package/src/types.tsx
CHANGED
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '1.
|
|
2
|
+
export const version = '1.6.0';
|