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.

Doesn't work with data from the server

See original GitHub issue

Hi, thanks for this tool, it’s amazing. Unfortunately, i have a little problem , It doesn’t work with dynamic data, maybe something i made wrong ? Here is my code

<template>
<tree
        ref="tree"
        :data="treeData"
  />
</template>
<script>
...
    data: () => ({
      treeData: []
    }),
    mounted: function () {
       this.getTreeData()
    },
    methods: {
       getTreeData() {
             var self = this
             axios.get('http://localhost:8082/files')
             .then((response) => {
                       self.treeData = response.data
              })
             .catch((err) => {
                console.log('Error : ' + err)
             })
       }
...
</script>

Thank you !

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
ijpatriciocommented, Jun 13, 2018

Hello, so I understood now.

The “data” prop passed, gets copied to a new object, inside the TreeRoot.vue component (node_modules folder, for backend developers better understanding)

This happens because props are immutable, so to maniputate data, the component copies to internal component “data” key.

After server loading, even computed propertie… the empty array was already copied. Check this by analyzing vue dev tools… the component model key will be empty.

Ok, quick fix. Have the component with a v-if directive

image

This way, “when you will enable it to show”, it will mount the component again, and props wil be already set, and properly copied!

PS: Very IMPORTANT to use v-if and not v-show!! v-if detaches from virtual dom on toggling, and v-show only changes style to “display: none”

0reactions
amsikcommented, Jun 15, 2018

Yeah. You are totally right. I have to copy recieved data to a new object because tree uses a its own structure. I think about adding watchers and get rid of this approach… but I will do it later.

That’s why we have a several approaches:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Effective Ways To Fix "Couldn't Open Connection To Server"
Here are some of the most effective ways to fix "Couldn't Open Connection To Server." We also answer some top questions!
Read more >
How to fix the problem 'can't connect to server' but the internet ...
Your mobile internet uses your carrier's internet connection, not your ISP's connection. Your ISP may be down, or your router may not be...
Read more >
Android mobile data not working? Here are some solutions
You might be facing a cellular data issue. Here are some solutions to restore mobile data. Read Next: Common Android issues and how...
Read more >
Android Cellular Data Not Working? 8 Ways to Fix
Start by pulling the SIM card tray out of your phone. Remove the SIM card from the tray, reinsert the card properly, and...
Read more >
How to fix iPhone and iPad Cellular Data not working? - Setapp
The article outlines key solutions for the situation when cellular data is not working on your iPhone or iPad.
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