Skip to content
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

TypeError при destroy() #600

Closed
johnnygrossamer opened this issue Mar 20, 2024 · 5 comments
Closed

TypeError при destroy() #600

johnnygrossamer opened this issue Mar 20, 2024 · 5 comments
Labels

Comments

@johnnygrossamer
Copy link

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

  • air-datepicker подключен как пакет в package.json
  • ошибка случается только в production версии после сборки, в режиме разработки ошибок нет
  • altFieldDateFormat и altField не используются в проекте вообще

Ошибка:
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
Copy link
Owner

t1m0n commented Mar 21, 2024

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

@t1m0n t1m0n added the bug label Mar 21, 2024
@elYanuki
Copy link

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
Copy link
Owner

t1m0n commented Mar 22, 2024

@elYanuki I should definitely fix this)

@johnnygrossamer
Copy link
Author

johnnygrossamer commented May 10, 2024

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

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

t1m0n added a commit that referenced this issue May 13, 2024
…have empty values after calendar is destroyed
t1m0n added a commit that referenced this issue May 13, 2024
t1m0n added a commit that referenced this issue May 13, 2024
@t1m0n t1m0n mentioned this issue May 13, 2024
t1m0n added a commit that referenced this issue May 13, 2024
* #600 - added `isDestroyed` property, opts and selectedDates now will have empty values after calendar is destroyed

* #600 - added docs for `isDestroyed`

* #600 - bupm version, added logs

* fixed log
@t1m0n
Copy link
Owner

t1m0n commented May 13, 2024

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()

@t1m0n t1m0n closed this as completed May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants