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

fix(runtime-dom): "el._assign is not a function" in compat mode #4121

Merged
merged 2 commits into from
May 10, 2022

Conversation

jaulz
Copy link
Contributor

@jaulz jaulz commented Jul 14, 2021

In compat mode el._assign is not a function is thrown when you bind a model to a radio button because onUpdate:modelValue does not exist in the props. As far as I could see in compat mode it's called onModelCompat:input instead:
https://github.com/vuejs/vue-next/blob/4f17be7b1ce4872ded085a36b95c1897d8c1f299/packages/runtime-core/src/compat/componentVModel.ts#L38-L40

I created a reproducible repository here:
https://github.com/jaulz/vue-repro

@yyx990803
Copy link
Member

Hmm, the logic is guarded to be only applied to component vnodes: https://github.com/vuejs/vue-next/blob/4f17be7b1ce4872ded085a36b95c1897d8c1f299/packages/runtime-core/src/compat/componentVModel.ts#L18

I'd love to see a reproduction to make sure we find the right fix.

@jaulz
Copy link
Contributor Author

jaulz commented Jul 27, 2021

@yyx990803 thanks for your response! In order to reproduce it you can clone https://github.com/jaulz/vue-repro and run it via yarn serve. Just click any of the options at the top.

@posva
Copy link
Member

posva commented Jul 27, 2021

@jaulz Your reproduction is way too large, can you boil it down to only Vue and no external libs so we can take a look? (https://new-issue.vuejs.org/?repo=vuejs/vue-next#why-repro)

@xanf
Copy link
Contributor

xanf commented Nov 17, 2021

@yyx990803 @posva

While working on migration of bootstrap-vue to @vue/compat I believe I was able to extract minimal possible example:

import Vue from "@vue/compat";

const App = {
  compatConfig: {
    MODE: 3,
    COMPONENT_V_MODEL: true,
    RENDER_FUNCTION: true
  },
  render(h) {
    return h("input", {
      on: {
        input() {
          console.log("invoked");
        }
      },
      // This comment was in original code (bootstrap-vue):
      // Directive needed to   get `event.target.composing` set (if needed)
      directives: [{ name: "model", value: "foo" }]
    });
  }
};

Vue.createApp(App).mount("#app");

CodeSandbox

According to v2 docs - usage of v-model directive from render function was never promoted, but it will be cool to have this fixed for better compat-build compatibility

@netlify
Copy link

netlify bot commented May 10, 2022

Deploy Preview for vuejs-coverage failed.

Name Link
🔨 Latest commit ad48bd0
🔍 Latest deploy log https://app.netlify.com/sites/vuejs-coverage/deploys/6279c66e4382f30008615857

@netlify
Copy link

netlify bot commented May 10, 2022

Deploy Preview for vue-next-template-explorer failed.

Name Link
🔨 Latest commit ad48bd0
🔍 Latest deploy log https://app.netlify.com/sites/vue-next-template-explorer/deploys/6279c66e3bed4a0008f6694d

@netlify
Copy link

netlify bot commented May 10, 2022

Deploy Preview for vue-sfc-playground failed.

Name Link
🔨 Latest commit ad48bd0
🔍 Latest deploy log https://app.netlify.com/sites/vue-sfc-playground/deploys/6279c66e6a76100008f87218

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

Successfully merging this pull request may close these issues.

None yet

4 participants