fix(rack-planner): resolve infinite re-render loop in ConnectionLayer and add null-safety for VLAN tooltips
This commit is contained in:
@@ -40,11 +40,17 @@ export function ConnectionLayer() {
|
||||
// Also re-calculate if the user scrolls (though ideally lines are pinned to the canvas)
|
||||
// Actually, if SVG is INSIDE the scrollable container, we don't need scroll adjustment.
|
||||
|
||||
// We'll use a MutationObserver to detect DOM changes (like modules being added/moved)
|
||||
const observer = new MutationObserver(updateCoords);
|
||||
// Use a MutationObserver to detect DOM changes (like modules being added/moved)
|
||||
const observer = new MutationObserver(() => {
|
||||
// Small debounce or check if it was our OWN SVG that changed
|
||||
updateCoords();
|
||||
});
|
||||
|
||||
const canvas = document.querySelector('.rack-planner-canvas');
|
||||
if (canvas) {
|
||||
observer.observe(canvas, { childList: true, subtree: true, attributes: true });
|
||||
// DO NOT observe the entire subtree with attributes if it includes the ConnectionLayer
|
||||
// Instead, just watch for module layout changes
|
||||
observer.observe(canvas, { childList: true, subtree: true });
|
||||
}
|
||||
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user