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

Error on setting value #132

Closed
aquadk opened this issue Feb 20, 2019 · 2 comments
Closed

Error on setting value #132

aquadk opened this issue Feb 20, 2019 · 2 comments
Labels

Comments

@aquadk
Copy link

aquadk commented Feb 20, 2019

I'm submitting a ... (check one with "x")

[x ] Bug report => search github for a similar issue or PR before submitting
[ ] Feature request
[ ] Other, please describe

Tell about your platform

  • flatPickr version : 4.x.x
  • Vue.js version : 2.6.x
  • Browser name and version : Chrome|Firefox|Safari x.x.x
  • This package version : x.x.x

Current behavior
Get this error in console:
[Vue warn]: Error in nextTick: "TypeError: Cannot read property 'value' of null"
stacktrace:

warn | @ | vue.runtime.esm.js:619
-- | -- | --
  | logError | @ | vue.runtime.esm.js:1874
  | globalHandleError | @ | vue.runtime.esm.js:1869
  | handleError | @ | vue.runtime.esm.js:1835
  | (anonymous) | @ | vue.runtime.esm.js:1972
  | flushCallbacks | @ | vue.runtime.esm.js:1896
  | Promise.then (async) |   |  
  | timerFunc | @ | vue.runtime.esm.js:1923
  | nextTick | @ | vue.runtime.esm.js:1980
  | Vue.$nextTick | @ | vue.runtime.esm.js:3490
  | onInput | @ | vue-flatpickr.min.js:141
  | invokeWithErrorHandling | @ | vue.runtime.esm.js:1847
  | invoker | @ | vue.runtime.esm.js:2169
  | original._wrapper | @ | vue.runtime.esm.js:6855
  | triggerEvent | @ | flatpickr.js:1980
  | setDate | @ | flatpickr.js:1860
  | value | @ | vue-flatpickr.min.js:167

Expected behavior
/**
* Watch for value changed by date-picker itself and notify parent component
*
* @param event
*/
onInput(event) {
// Lets wait for DOM to be updated
this.$nextTick(() => {
event.target && this.$emit('input', event.target.value);
});
},

Can be solved by checking for target is assigned

Minimal reproduction of the problem with instructions
Error when setting value on component.

@ankurk91
Copy link
Owner

Could not reproduce the error described.

https://jsfiddle.net/nzypq8gw/

@Silentscripter
Copy link
Contributor

The bug seems to happen when the component is used in a vue app that is wrapped inside a webcomponent. A pull request to fix the issue has been provided and linked.

@ankurk91 ankurk91 added the bug label Aug 21, 2019
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