-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle when rtcIceCandidateStatsReport
is undefined
#280
Handle when rtcIceCandidateStatsReport
is undefined
#280
Conversation
c0da4aa
to
a6ca00c
Compare
In the case where rtcIceCandidateStatsReport is never set, we cannot read from one of its properties. This change ensures that a default value is set when rtcIceCandidateStatsReport is undefined.
a6ca00c
to
291b8a1
Compare
@@ -292,7 +292,7 @@ export class PreflightTest extends EventEmitter { | |||
const report: PreflightTest.Report = { | |||
callSid: this._callSid, | |||
edge: this._edge, | |||
iceCandidateStats: this._rtcIceCandidateStatsReport.iceCandidateStats, | |||
iceCandidateStats: this._rtcIceCandidateStatsReport?.iceCandidateStats ?? [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iceCandidateStats
cannot be undefined
so we change to empty array.
export interface Report {
...
iceCandidateStats: RTCIceCandidateStats[];
...
@phi-line thanks for submitting this PR. It's simple and I understand why this is needed. We'll take a closer look and make sure there are no side effects. |
@charliesantos thanks for the reply. Just to add some more context: I found an active issue with the sdk when running the pre-flight test. Looks like this property const report: PreflightTest.Report = {
callSid: this._callSid,
edge: this._edge,
>>> iceCandidateStats: this._rtcIceCandidateStatsReport.iceCandidateStats,
networkTiming: this._networkTiming,
samples: this._samples,
selectedEdge: this._options.edge,
stats,
testTiming, Cannot read properties of undefined (reading 'iceCandidateStats') Seems like this needs better typescript handling so I created this PR that improves the handling when |
Thanks @phi-line . Seems like a good fix. We're currently working on this and expect a release in the next few days. |
Contributing to Twilio
Pull Request Details
JIRA link(s):
Description
In the case where rtcIceCandidateStatsReport is never set, we cannot read from one of its properties. This change ensures that a default value is set when rtcIceCandidateStatsReport is undefined.
Burndown
Before review
npm test
Before merge