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.

`data` prop not reactive ?

See original GitHub issue

Hey, just tried liquor-tree and as it seems from initial tests it’s not reactive. My data is primary asynchronous and all my components have no data when mounted and rely on the reactive nature of vuejs. I looked at liquor source and it looks like the render uses a model property that is generated only once on mounted() (once per component instance) and not part of data() function.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
amsikcommented, Mar 12, 2018

Hey! Yes, this property in not reactive. It is parsing once on mounted() hook. I’ve prepared some example to fix your problem. It’s not a beautiful approach, but it works. Try it out: https://jsfiddle.net/amsik/b61h6wxk/10/

In nearly future I’m going to add a new API for async operation and listening for ‘props’ changes.

0reactions
entrcommented, Mar 23, 2018

Well, I’ll just repost the example. It must had been a really long week for me:

export default {
  props: ['initialTreeData'],

  data() {
    return {
      treeData: this.initialTreeData,
    }
  },
  
  watch: {
    initialTreeData( newData ) {
      this.treeData = `newData`
      // do data transformations etc
      // trigger UI refresh
    }
  }
}

Sorry for the notification spam 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is this Vue prop not reacting to change? - Stack Overflow
Usually components should be reactive to Props, though i have had experiences where it was non-reactive so i added the prop to a...
Read more >
Vue2 Props are not Reactive - Vue Forum
So the data changes, I've logged it and run length checks on the object before and after it has been spliced, it does...
Read more >
reactivity does not work on root component props when using ...
Version 3.2.20 Reproduction link sfc.vuejs.org/ Steps to reproduce Pass a reactive({}) object into createApp's second parameter, ...
Read more >
Props - Vue Explanation
Some articles will also tell you both are reactive. All the above answers are correct. However, from technical perspective, props is different from...
Read more >
Vue: Making props passed from parent > child reactive after ...
I have a parent that passes a prop to a child: data() initializes the value to false: data() ... Not sure if there...
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