question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

functional component wrapping with context.data causes v-model to update twice

See original GitHub issue

Version

2.5.16

Reproduction link

https://codepen.io/anon/pen/LrMKMg?editors=1011

Steps to reproduce

type in the input

What is expected?

'input' should be logged once

What is actually happening?

'input' is logged twice


Uncomment delete ctx.data.model and it works fine

Original pen using vuetify: https://codepen.io/anon/pen/QxzXYK?editors=1011

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
KaelWDcommented, Aug 19, 2018

Here’s my solution until this is fixed in vue:

function dedupeModelListeners (data: VNodeData): void {
  if (data.model && data.on && data.on.input) {
    if (Array.isArray(data.on.input)) {
      const i = data.on.input.indexOf(data.model.callback)
      if (i > -1) data.on.input.splice(i, 1)
    } else {
      delete data.on.input
    }
  }
}
1reaction
KaelWDcommented, Jul 22, 2018

Turns out someone was relying on data.model.expression, but I can’t find a way to allow that without breaking a bunch of other shit: https://github.com/vuetifyjs/vuetify/issues/4460#issuecomment-406870878

Read more comments on GitHub >

github_iconTop Results From Across the Web

Recipes to Wrap, Extend or Proxy a Vue Component - Medium
This article details some ways to create a component that extends another. We'll look at attributes, props, listeners, and slots, along with ...
Read more >
Vue Js pass all context when wrapping components with ...
I solved the issue. So it looks like the names of the properties in the data object ...
Read more >
Validation Provider - VeeValidate
The ValidationProvider component is a regular component that wraps your inputs and provides validation state using scoped slots .
Read more >
I wrote vuex — but for React! The challenges I faced and ...
A context provider for a collection of getter contexts, wrapped in a memo() to prevent re-creating; Dynamically created context (and provider) ...
Read more >
Forms - Vue Formulate
You can read and write to form values using v-model just as you would on an input. ... This makes it easy to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found