Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

- Normalize data properties of `SentryUser` and `Breadcrumb` before sending over method channel ([#1591](https://github.com/getsentry/sentry-dart/pull/1591))
- Fixing memory leak issue in SentryFlutterPlugin (Android Plugin) ([#1588](https://github.com/getsentry/sentry-dart/pull/1588))
- Disable scope sync for cloned scopes ([#1628](https://github.com/getsentry/sentry-dart/pull/1628))

### Dependencies

Expand Down
6 changes: 4 additions & 2 deletions dart/lib/src/scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class Scope {
List.unmodifiable(_eventProcessors);

final SentryOptions _options;
bool _enableScopeSync = true;

final List<SentryAttachment> _attachments = [];

Expand Down Expand Up @@ -423,7 +424,8 @@ class Scope {
..level = level
..fingerprint = List.from(fingerprint)
.._transaction = _transaction
..span = span;
..span = span
.._enableScopeSync = false;

clone._setUserSync(user);

Expand Down Expand Up @@ -461,7 +463,7 @@ class Scope {
}

Future<void> _callScopeObservers(_OnScopeObserver action) async {
if (_options.enableScopeSync) {
if (_options.enableScopeSync && _enableScopeSync) {
for (final scopeObserver in _options.scopeObservers) {
await action(scopeObserver);
}
Expand Down
8 changes: 8 additions & 0 deletions dart/test/scope_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,14 @@ void main() {
expect(1, fixture.mockScopeObserver.numberOfRemoveTagCalls);
});

test('clone has disabled scope sync', () async {
final sut = fixture.getSut(scopeObserver: fixture.mockScopeObserver);
final clone = sut.clone();

await clone.setContexts("fixture-contexts-key", "fixture-contexts-value");
expect(0, fixture.mockScopeObserver.numberOfSetContextsCalls);
});

group('Scope apply', () {
final scopeUser = SentryUser(
id: '800',
Expand Down
24 changes: 12 additions & 12 deletions dio/test/dio_event_processor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void main() {
throwable: throwable,
exceptions: [
fixture.sentryError(throwable),
fixture.sentryError(dioError)
fixture.sentryError(dioError),
],
);
final processedEvent = sut.apply(event) as SentryEvent;
Expand Down Expand Up @@ -96,7 +96,7 @@ void main() {
throwable: throwable,
exceptions: [
fixture.sentryError(throwable),
fixture.sentryError(dioError)
fixture.sentryError(dioError),
],
);
final processedEvent = sut.apply(event) as SentryEvent;
Expand Down Expand Up @@ -125,7 +125,7 @@ void main() {
throwable: throwable,
exceptions: [
fixture.sentryError(throwable),
fixture.sentryError(dioError)
fixture.sentryError(dioError),
],
);
final processedEvent = sut.apply(event) as SentryEvent;
Expand Down Expand Up @@ -177,7 +177,7 @@ void main() {
throwable: throwable,
exceptions: [
fixture.sentryError(throwable),
fixture.sentryError(dioError)
fixture.sentryError(dioError),
],
);
final processedEvent = sut.apply(event) as SentryEvent;
Expand Down Expand Up @@ -207,7 +207,7 @@ void main() {
data: 'foobar',
headers: Headers.fromMap(<String, List<String>>{
'foo': ['bar'],
'set-cookie': ['foo=bar']
'set-cookie': ['foo=bar'],
}),
requestOptions: request,
isRedirect: true,
Expand All @@ -219,7 +219,7 @@ void main() {
throwable: throwable,
exceptions: [
fixture.sentryError(throwable),
fixture.sentryError(dioError)
fixture.sentryError(dioError),
],
);
final processedEvent = sut.apply(event) as SentryEvent;
Expand Down Expand Up @@ -248,7 +248,7 @@ void main() {
response: Response<dynamic>(
data: 'foobar',
headers: Headers.fromMap(<String, List<String>>{
'foo': ['bar']
'foo': ['bar'],
}),
requestOptions: request,
isRedirect: true,
Expand All @@ -260,7 +260,7 @@ void main() {
throwable: throwable,
exceptions: [
fixture.sentryError(throwable),
fixture.sentryError(dioError)
fixture.sentryError(dioError),
],
);
final processedEvent = sut.apply(event) as SentryEvent;
Expand Down Expand Up @@ -320,7 +320,7 @@ void main() {
throwable: throwable,
exceptions: [
fixture.sentryError(throwable),
fixture.sentryError(dioError)
fixture.sentryError(dioError),
],
);
final processedEvent = sut.apply(event) as SentryEvent;
Expand All @@ -338,7 +338,7 @@ void main() {
final dataByType = {
ResponseType.plain: ['plain'],
ResponseType.bytes: [
[1337]
[1337],
],
ResponseType.json: [
9001,
Expand All @@ -347,7 +347,7 @@ void main() {
true,
['list'],
{'map-key': 'map-value'},
]
],
};

for (final entry in dataByType.entries) {
Expand Down Expand Up @@ -375,7 +375,7 @@ void main() {
throwable: throwable,
exceptions: [
fixture.sentryError(throwable),
fixture.sentryError(dioError)
fixture.sentryError(dioError),
],
);
final processedEvent = sut.apply(event) as SentryEvent;
Expand Down
2 changes: 1 addition & 1 deletion dio/test/failed_request_interceptor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Fixture {

FailedRequestInterceptor getSut({
List<SentryStatusCode> failedRequestStatusCodes = const [
SentryStatusCode.defaultRange()
SentryStatusCode.defaultRange(),
],
List<String> failedRequestTargets = const ['.*'],
}) {
Expand Down
2 changes: 1 addition & 1 deletion dio/test/mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final fakeEvent = SentryEvent(
type: 'navigation',
data: <String, dynamic>{'screen': 'MainActivity', 'state': 'created'},
level: SentryLevel.info,
)
),
],
contexts: Contexts(
operatingSystem: const SentryOperatingSystem(
Expand Down