Skip to content

Commit ec2013e

Browse files
authored
beforeBreadcrumb was not adding the mutated breadcrumb (#982)
1 parent 2ada18f commit ec2013e

File tree

6 files changed

+27
-4
lines changed

6 files changed

+27
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Unreleased
44

5+
### Fixes
6+
7+
* Scope.clone incorrectly accesses tags ([#978](https://github.com/getsentry/sentry-dart/pull/978))
8+
* beforeBreadcrumb was not adding the mutated breadcrumb ([#982](https://github.com/getsentry/sentry-dart/pull/982))
9+
510
### Features
611

712
- Bump Cocoa SDK to v7.23.0 ([#968](https://github.com/getsentry/sentry-dart/pull/968))

dart/lib/src/scope.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class Scope {
194194
_breadcrumbs.removeFirst();
195195
}
196196

197-
_breadcrumbs.add(breadcrumb);
197+
_breadcrumbs.add(processedBreadcrumb);
198198
return true;
199199
}
200200

dart/test/http_client/tracing_client_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class Fixture {
154154
MockClient getClient({int statusCode = 200, String? reason}) {
155155
return MockClient((request) async {
156156
expect(request.url, requestUri);
157-
return Response('', statusCode, reasonPhrase: reason);
157+
return Response('', statusCode, reasonPhrase: reason, request: request);
158158
});
159159
}
160160
}

dart/test/scope_test.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ void main() {
9797
expect(sut.breadcrumbs.length, 0);
9898
});
9999

100+
test('Executes and mutates $Breadcrumb', () {
101+
final sut = fixture.getSut(
102+
beforeBreadcrumbCallback: fixture.beforeBreadcrumbMutateCallback,
103+
);
104+
105+
final breadcrumb = Breadcrumb(
106+
message: 'message',
107+
timestamp: DateTime.utc(2019),
108+
);
109+
sut.addBreadcrumb(breadcrumb);
110+
111+
expect(sut.breadcrumbs.first.message, 'new message');
112+
});
113+
100114
test('adds $EventProcessor', () {
101115
final sut = fixture.getSut();
102116

@@ -642,6 +656,10 @@ class Fixture {
642656
Breadcrumb? beforeBreadcrumbCallback(Breadcrumb? breadcrumb,
643657
{dynamic hint}) =>
644658
null;
659+
660+
Breadcrumb? beforeBreadcrumbMutateCallback(Breadcrumb? breadcrumb,
661+
{dynamic hint}) =>
662+
breadcrumb?.copyWith(message: 'new message');
645663
}
646664

647665
class AddTagsEventProcessor extends EventProcessor {

flutter/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
97C146E61CF9000F007C117D /* Project object */ = {
161161
isa = PBXProject;
162162
attributes = {
163-
LastUpgradeCheck = 1330;
163+
LastUpgradeCheck = 1300;
164164
ORGANIZATIONNAME = "";
165165
TargetAttributes = {
166166
97C146ED1CF9000F007C117D = {

flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1330"
3+
LastUpgradeVersion = "1300"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

0 commit comments

Comments
 (0)