Open
Description
Описание
Is response possible undefined?
// current code
export class MyTrackerService {
// current code
public init() {
this.getTrackerId()
.then(({ response }) => {
if (response.active === MyTrackerStatus.ON) { // response is undefined → error
this.includeOnPage(response.tracker_id);
}
})
.catch(console.error);
}
}
// proposal code
export class MyTrackerService {
// proposal code
public init() {
this.getTrackerId()
.then(({ response }) => {
// if (response.active === MyTrackerStatus.ON) { // response is undefined → error
if (response && response.active === MyTrackerStatus.ON) {
this.includeOnPage(response.tracker_id);
}
})
.catch(console.error);
}
}
Шаги воспроизведения
Run Config.init method
Версия vkid/sdk
2.4.0
В каких браузерах воспроизводится проблема?
Yandex Browser
Ожидаемое поведение
Response exists check
Скриншоты
Пример с воспроизведением
No response