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 when changing disabledDates #70

Closed
happydude opened this issue May 22, 2019 · 3 comments
Closed

TypeError when changing disabledDates #70

happydude opened this issue May 22, 2019 · 3 comments

Comments

@happydude
Copy link
Contributor

I'm working on updating a project from ember 3.4 to 3.8. I'm running into a TypeError when changing the dates on the array passed into disabledDates.

metal.js:289 Uncaught TypeError: Cannot read property 'apply' of undefined
    at sendEvent (metal.js:289)
    at ObserverSet.flush (metal.js:417)
    at endPropertyChanges (metal.js:855)
    at changeProperties (metal.js:881)
    at setProperties (metal.js:3710)
    at Class.setProperties (observable.js:193)
    at CurlyComponentManager.update (glimmer.js:4435)
    at UpdateComponentOpcode.evaluate (runtime.js:1888)
    at UpdatingVM.execute (runtime.js:4280)
    at RenderResult.rerender (runtime.js:4607)

When pausing on exceptions I see an action of updateDisabledDates on InteractiveRenderer.
I saw in addon/components/bs-datetimepicker.js there is an add and remove observer for updateDisabledDates but I cannot find where this is defined.

I was able to duplicate the issue with a test in bs-datetimepicker-test.js #69

Just changing the array is all that is needed to replicate the error

this.set('disabledDates',['2016-01-02','2016-01-03']);
await render(hbs`{{bs-datetimepicker date='2016-01-01' disabledDates=disabledDates openOnFocus=true}}`);
this.set('disabledDates',['2016-01-02','2016-01-03','2016-01-04']);
@btecu
Copy link
Owner

btecu commented May 22, 2019

Yes, updateDisabledDates is missing:

  updateDisabledDates() {
    this.picker().disabledDates(this.get('disabledDates'));
  },

Can you try add it see if works?

@happydude
Copy link
Contributor Author

Thank you, that seems to have done the trick. I have added it to the pull request

@btecu
Copy link
Owner

btecu commented Dec 3, 2019

Fixed in #69.

@btecu btecu closed this as completed Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants