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

Hot reload not working with global functional components #75

Open
linniksa opened this issue Aug 14, 2019 · 0 comments
Open

Hot reload not working with global functional components #75

linniksa opened this issue Aug 14, 2019 · 0 comments

Comments

@linniksa
Copy link

linniksa commented Aug 14, 2019

test.vue

<template functional>
    <div>example</div>
</template>

main.js

import test from 'test.vue'

Vue.component('test', test)

App.vue

<template>
    <div>
         <test />
    </div>
</template>

If i changing test.vue file - hot reload won't works.
As i can see this is because Vue.component creates new options object, but hot reload stores original component object

if i adds something like this:

function makeOptionsHot(id, options) {
  if (options.functional) {
    var render = options.render
    options.render = function (h, ctx) {
+     var record = map[id]
+     if (record.options !== ctx.$options) {
+         record.options = ctx.$options
+     }
      var instances = map[id].instances
      if (ctx && instances.indexOf(ctx.parent) < 0) {
        instances.push(ctx.parent)
      }
      return render(h, ctx)
    }

all works as expected

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

1 participant