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

Bug props in composition-api beta 14 #534

Closed
pinghe opened this issue Sep 22, 2020 · 2 comments · Fixed by #547
Closed

Bug props in composition-api beta 14 #534

pinghe opened this issue Sep 22, 2020 · 2 comments · Fixed by #547
Assignees
Labels
bug Something isn't working

Comments

@pinghe
Copy link

pinghe commented Sep 22, 2020

export default {
  props: {
    filter: {
      type: Object,
      default: function() {
        return {
          c1: 'c1',
        }
      },
    },
  },
  setup(props) {
    console.log('props is: ', isRef(props), isReactive(props))
    watch(props, () => {  // error 
      console.log(props)
    }
  }
}

beta11: props is: false true
beta14: props is: false false // watch --> error

@antfu
Copy link
Member

antfu commented Oct 1, 2020

What's the error you have?

@LinusBorg
Copy link
Member

the props argument should be detected as a reactive, but isn't.

That's because we use ob do detect that, and the props argument isn't a real Vue.observable, it's "faked":

// fake reactive for `toRefs(props)`
def(props, PropsReactive, true)

...and therefore has no ob and is not detected as a reactive object by isReactive()

@antfu antfu added the bug Something isn't working label Oct 1, 2020
@antfu antfu self-assigned this Oct 1, 2020
@pikax pikax closed this as completed in #547 Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants