Skip to content

Commit

Permalink
fix: Clone obj before sending it over bridge
Browse files Browse the repository at this point in the history
Fixes #347
  • Loading branch information
HazAT committed Feb 16, 2018
1 parent 0e0300d commit e23ac61
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/NativeClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,36 @@ export class NativeClient {
});
}

_cloneObject(obj) {
return JSON.parse(JSON.stringify(obj));
}

nativeCrash() {
RNSentry.crash();
}

captureEvent(event) {
RNSentry.captureEvent(event);
RNSentry.captureEvent(this._cloneObject(event));
}

setUserContext(user) {
RNSentry.setUser(user);
RNSentry.setUser(this._cloneObject(user));
}

setTagsContext(tags) {
RNSentry.setTags(tags);
RNSentry.setTags(this._cloneObject(tags));
}

setExtraContext(extra) {
RNSentry.setExtra(extra);
RNSentry.setExtra(this._cloneObject(extra));
}

addExtraContext(key, value) {
RNSentry.addExtra(key, value);
}

captureBreadcrumb(breadcrumb) {
RNSentry.captureBreadcrumb(breadcrumb);
RNSentry.captureBreadcrumb(this._cloneObject(breadcrumb));
}

clearContext() {
Expand Down

0 comments on commit e23ac61

Please sign in to comment.