change(tracker): webworker has a bug where after being foregrounded (on mobile especially), if the writer or sender is not present, it will throw an error which will bubble up and crash the entire app. Instead, log a debug message and allow the writer / sender to reinit
This commit is contained in:
parent
a116a30969
commit
d58b3181dc
1 changed files with 6 additions and 4 deletions
|
|
@ -136,13 +136,15 @@ self.onmessage = ({ data }: any): any => {
|
|||
|
||||
if (data.type === 'auth') {
|
||||
if (!sender) {
|
||||
throw new Error('WebWorker: sender not initialised. Received auth.')
|
||||
console.debug('WebWorker: sender not initialised. Received auth.')
|
||||
}
|
||||
if (!writer) {
|
||||
throw new Error('WebWorker: writer not initialised. Received auth.')
|
||||
console.debug('WebWorker: writer not initialised. Received auth.')
|
||||
}
|
||||
if (sender && writer) {
|
||||
sender.authorise(data.token)
|
||||
data.beaconSizeLimit && writer.setBeaconSizeLimit(data.beaconSizeLimit)
|
||||
}
|
||||
sender.authorise(data.token)
|
||||
data.beaconSizeLimit && writer.setBeaconSizeLimit(data.beaconSizeLimit)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue