While precomputing everything is nice, it creates a huge lag spike every time someone opens or closes a section or reloads the page.
Firstly, only redraw the lines. Furthermore only compute the "visible" part of the NBT tree; Lazyload everything else when needed.
Also change from a strict grid based system to one where you can easily hide sub-trees using a CSS class. So when the tree was already computed, it'll just be made invisible when it's not needed anymore or visible if needed.
This will also eliminate the need to set the input of the input every time smth is reloaded.
While precomputing everything is nice, it creates a huge lag spike every time someone opens or closes a section or reloads the page. Firstly, only redraw the lines. Furthermore only compute the "visible" part of the NBT tree; Lazyload everything else when needed. Also change from a strict grid based system to one where you can easily hide sub-trees using a CSS class. So when the tree was already computed, it'll just be made invisible when it's not needed anymore or visible if needed. This will also eliminate the need to set the input of the input every time smth is reloaded.