Skip to content

Commit 3de1705

Browse files
committed
Guard destroying the component.
When running an `ember` application embedded, it might cause the DOM to be cleaned before the `willDestroyElement` hook runs.
1 parent a413d9a commit 3de1705

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

addon/components/bs-datetimepicker.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ export default Component.extend({
9090
this.removeObserver('maxDate');
9191
this.removeObserver('minDate');
9292

93-
this.$().data('DateTimePicker').destroy();
93+
// Running the `ember` application embedded might cause the DOM to be cleaned before
94+
let dateTimePicker = this.$().data('DateTimePicker');
95+
if (dateTimePicker) {
96+
dateTimePicker.destroy();
97+
}
9498
},
9599

96100
actions: {

0 commit comments

Comments
 (0)