renderNode()

in src/components/graph-view-v2.js [1584:1617]


  renderNode(id: string, element: Element) {
    if (!this.entities) {
      return null;
    }

    const containerId = `${id}-container`;

    let nodeContainer:
      | HTMLElement
      | Element
      | null = this.viewWrapper.current.querySelector(`[id='${containerId}']`);

    if (!nodeContainer) {
      nodeContainer = document.createElementNS(
        'http://www.w3.org/2000/svg',
        'g'
      );
      nodeContainer.id = containerId;
      this.entities.appendChild(nodeContainer);
    }

    const anyElement: any = element;

    let root = this.roots[containerId];

    if (!root) {
      root = createRoot(nodeContainer, {
        identifierPrefix: containerId,
      });
      this.roots[containerId] = root;
    }

    root.render(anyElement);
  }