react-d3-treemap icon indicating copy to clipboard operation
react-d3-treemap copied to clipboard

Lazy loading children

Open pankajvishwani opened this issue 6 years ago • 4 comments

Hi, Is there anyway I can lazily load children when user clicks on a tile?

pankajvishwani avatar Oct 22 '17 00:10 pankajvishwani

Hi @pankajvishwani , Please could you explain your question little bit more. Not sure what you mean with lazily load children.. Lazy load the data for this children ?

jquintozamora avatar Jan 26 '18 23:01 jquintozamora

Referring to "src/data/data.ts" file, I have data that looks something like this:

const data = {
  name: "flare",
  children: [
    { name: "analytics", hasChildren: true },
    { name: "animater", hasChildren: true}
  ]
}

Now, when user clicks on analytics, that's when I want to make a request to get it's children.

pankajvishwani avatar Jan 27 '18 02:01 pankajvishwani

Hi @pankajvishwani , This component was designed to load the whole data structure initially. The reason is to be more responsive for the user perspective.

However, PR is accepted with some changes for Async approach as far the normal approach continue working.

Good feedback, really appreciated.

jquintozamora avatar Jan 27 '18 09:01 jquintozamora

Hey @pankajvishwani, I'm also trying to accomplish the same thing. Currently considering an async function that updates the tree data and to call this function when a node is clicked (and has children). Just curious as to what your solution was to load child nodes on demand.

NextDev65 avatar Aug 06 '21 20:08 NextDev65