fperucic / treant-js

Treant.js - javascript library for drawing tree diagrams
MIT License
864 stars 314 forks source link

When there are a large number of duplicate pictures in the tree, the loading speed will be very slow. #124

Closed AemonCao closed 5 years ago

AemonCao commented 6 years ago

In my tree, each node has an image. Although the number of pictures is large, most of them are repetitive and actually fewer than ten.

The tree diagram will appear particularly slow when loaded.

I checked the "developer tools" found:

_20180702155350

Each picture is followed by a timestamp parameter. I think it may be because of this parameter that causes the browser to identify the same picture as a different picture, resulting in repeated requests. As a result, the tree map is loaded too slowly.

Is there any way to solve this problem?

Thanks in advance.

AemonCao commented 6 years ago

I found the code for this part:

https://github.com/fperucic/treant-js/blob/a5f95627baa265a891858678de47dff180848613/Treant.js#L323

I commented it.

I got the effect I wanted.

Now I want to know the role of this line of code, so that I will have other problems in the future.

Hrnkas commented 6 years ago

Such code is used when you want to circumvent the browser cache. It is usefull when the images change often, i.e. product images in a Webshop. However, I always use just the date, without time, so the cache works for one day and tomorrow it is invalid and has to be loaded again.