md-date-time-picker
md-date-time-picker copied to clipboard
DateTimePicker.js:981 - Uncaught TypeError: Cannot read property 'removeChild' of null
Hi there, while playing around with this great project I'm getting the above exception.
Steps to reproduce:
- Open the default datepicker: // new mdDateTimePicker.default({type: 'date'});
- Multi-click on the previous or next month arrow icon fast enough (5 clicks per second)
- At some point, rather sooner than later, the API will break and the above exception will be thrown. As a result in the DOM the li.mddtp-picker__view element will start to grow.
It'll be great to have this issue fixed as this is a fairly easy-to-reproduce bug.
Thanks in advance.
Thanks for posting about this bug @jqp5000 I'll have a look at it.
keeping it open until a solution could be found
This seems to be a race condition. Reducing the timeout to 150 ms (i.e. not waiting until the month has finished its animation out of the dialog) prevents the issue. Really, setTimeout
probably isn't a very robust way to handle these things.
@qpoon I know but when I first started the development I was a front end noob 😝 and didnt know much js so this was the solution that came to my mind
There are two solutions that have come to my mind for that:
- adding cancel timeouts to prevent the propogation of previous timeouts and setting timeout to 150ms
- detecting animation end and then doing stuff and canceling if a new one comes.
@puranjayjain. Did you experiment those solutions? Are you planning to fix this bug?
@papasax I am currently heavily invested in a project and so cannot take up this task at the moment. Meanwhile, a PR is welcome as always.
this bug still occurs in version 2.3.0
your can dirty fix it by prevent mouseevents on disabled next or prev buttons
#mddtp-date__left:disabled,#mddtp-date__right:disabled{ pointer-events: none; }