t1m0n / air-datepicker

Lightweight, dependency-free JavaScript datepicker.
https://air-datepicker.com
MIT License
2.58k stars 1.36k forks source link

TypeError при destroy() #600

Closed johnnygrossamer closed 1 month ago

johnnygrossamer commented 3 months ago

Иногда случается ошибка при вызове destroy(),

Ошибка: Uncaught TypeError: Cannot destructure property 'altFieldDateFormat' of 'e' as it is null

Часть кода из сборки в котором случается ошибка: (()=>{let{opts:e,$altField:t,locale:{dateFormat:o}}=this,{altFieldDateFormat:n,altField:i}=e;...

t1m0n commented 3 months ago

Спасибо, надо глянуть

elYanuki commented 3 months ago

afaik this error occurs every single time a picker is destroyed

let picker = new AirDatepicker(input)
console.log(picker)
picker.destroy()

in this case I encounter the error: Cannot destructure property 'showEvent' of 'this.opts' as it is undefined

When adding more properties i additionally get the same error as OP even though i never used the altFieldDateFormat option

t1m0n commented 3 months ago

@elYanuki I should definitely fix this)

johnnygrossamer commented 1 month ago

Спасибо, надо глянуть

Позвольте уточнить стоит ли ожидать в ближайшее время исправления этой ошибки, честно говоря в bugreport уже тысячи этих ошибок, и на каждую я дергаюсь)

t1m0n commented 1 month ago

Fixed in 3.5.1 - added isDestroyed property - which should be manually checked if some of methods will be called after datepicker has been already destroyed. Also fixed some errors which were thrown after calling the destroy()