Skip to content

Commit

Permalink
Revert "Recursive metadata is now handled in react native"
Browse files Browse the repository at this point in the history
  • Loading branch information
lemnik authored Jan 19, 2022
1 parent 0baeac0 commit 99a0cb4
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 203 deletions.
6 changes: 2 additions & 4 deletions packages/delivery-react-native/delivery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const makeSafe = require('./make-safe')

module.exports = (client, NativeClient) => ({
sendEvent: (payload, cb = () => {}) => {
const event = payload.events[0]
Expand All @@ -19,10 +17,10 @@ module.exports = (client, NativeClient) => ({
app: event.app,
device: event.device,
threads: event.threads,
breadcrumbs: makeSafe(event.breadcrumbs),
breadcrumbs: event.breadcrumbs,
context: event.context,
user: event._user,
metadata: makeSafe(event._metadata),
metadata: event._metadata,
groupingHash: event.groupingHash,
apiKey: event.apiKey,
nativeStack: nativeStack
Expand Down
83 changes: 0 additions & 83 deletions packages/delivery-react-native/make-safe.js

This file was deleted.

102 changes: 0 additions & 102 deletions packages/delivery-react-native/test/make-safe.test.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ export class BreadcrumbsJsManualScenario extends Scenario {
const metaData = {
from: 'javascript'
}

// ensure that circular references are safely handled
metaData.circle = metaData

Bugsnag.leaveBreadcrumb('oh crumbs', metaData, 'state')
Bugsnag.notify(new Error('BreadcrumbsJsManualScenario'))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@ export class MetadataJsScenario extends Scenario {
}

run () {
const recursiveMetadata = {}
recursiveMetadata.data = 'some valid data'
recursiveMetadata.circle = recursiveMetadata

Bugsnag.addMetadata('jsdata', 'some_more_data', 'set via client')
Bugsnag.addMetadata('jsdata', 'redacted_data', 'not present')
Bugsnag.addMetadata('jsdata', 'recursive', recursiveMetadata)
Bugsnag.notify(new Error('MetadataJsScenario'), (event) => {
event.addMetadata('jsdata', 'even_more_data', 'set via event')
event.addMetadata('jsarraydata', 'items', ['a', 'b', 'c'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"name": "oh crumbs",
"timestamp": "^\\d{4}\\-\\d{2}\\-\\d{2}T\\d{2}:\\d{2}:[\\d\\.]+Z?$",
"metaData": {
"from": "javascript",
"circle": "[Circular]"
"from": "javascript"
}
}
}
2 changes: 0 additions & 2 deletions test/react-native/features/metadata.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ Scenario: Setting metadata (JS)
And the event "metaData.jsdata.some_more_data" equals "set via client"
And the event "metaData.jsdata.even_more_data" equals "set via event"
And the event "metaData.jsdata.redacted_data" equals "[REDACTED]"
And the event "metaData.jsdata.recursive.data" equals "some valid data"
And the event "metaData.jsdata.recursive.circle" equals "[Circular]"
And the error payload field "events.0.metaData.jsarraydata.items" is an array with 3 elements

Scenario: Setting metadata (native handled)
Expand Down

0 comments on commit 99a0cb4

Please sign in to comment.